Sibin P. Thomas wrote:
If u have Cygwin then creating a batch file with the following would be the
simplest solution -

set TARGETDIR=C:\something
set SCRIPTDIR=C:\something_else
find %TARGETDIR% -name "*.[ch]" -exec gvim -s %SCRIPTDIR%\win32_vimscript.vim
"{}" ";"

Basically use "find" to help u (actually it's just one instruction, so u
don't even need to have a batch file for it)

Regards,
Sibin

-----Original Message-----
From: Nikolaos A. Patsopoulos [mailto:[EMAIL PROTECTED] Sent: Thursday, September 14, 2006 3:31 PM
To: vim@vim.org
Subject: vim | multiple files editing and delete question

Hi,

I have a series of questions:


1. I want to edit multiple files from command line so I created a vim script with all the commands (>20). I use a batch file in WinXP:

|@echo off
vim -s script file.txt
exit


however I need to run this script on multiple files. In vim's help there is
this code for use in bash(?) shell

||for file in *.txt; do|
|         vim -e -s $file < change.vim|
|         lpr -r tempfile|
|done

however it doesn't seem to work under Cygwin.



2.Can I delete after a pattern search? Sth like this:

:/^<html\_.{-}<body>: /-3d

and how can I repeat this globally?
3. This is not Vim related but I wonder if anyone knows sth. I have the
following structure of folders and files:

..
folder1
        file1
        file2
folder2
        file1
        file2
.....


and want to add the folder name into the filename:
||

folder1
        ||folder1|_|file1
        ||folder1|_|||file2
folder2
        ||folder2|_|||file1
        ||folder2|_|||file2



Thanks in advance, Nikos
|

------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------
Disclaimer
-----------------------------------------------------------------------------------------------------------------------------

"This message(including attachment if any)is confidential and may be 
privileged.Before opening attachments please check them
for viruses and defects.MindTree Consulting Private Limited (MindTree)will not 
be responsible for any viruses or defects or
any forwarded attachments emanating either from within MindTree or outside.If you 
have received this message by mistake please notify the sender by return  e-mail and 
delete this message from your system. Any unauthorized use or dissemination of this 
message in whole or in part is strictly prohibited.  Please note that e-mails are 
susceptible to change and MindTree shall not be liable for any improper, untimely or 
incomplete transmission."

-----------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.3/447 - Release Date: 13/9/2006
Haven't tested your suggestion, but this works just fine:

for file in folder */*; do
    dir=$(basename "$(dirname "$file")")
    base=$(basename "$file")
    mv "$file" "$(dirname "$file")/${dir}_${base}"
done

Reply via email to