On 9/14/06, Nikolaos A. Patsopoulos <[EMAIL PROTECTED]> wrote:
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

Try this shell script:

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

Untested!

Yakov

Reply via email to