[oclug] filename renaming

Normand Fisher fishern at ncf.ca
Tue Sep 20 16:38:32 EDT 2011


I'd like to have a script to rename groups of files by including the 
directory name in the revised filename.

Ex:  in directory "A", I have files 1, 2, 3, 4, and 5.  
I would like to rename the files to A_1, A_2, A_3, A_4 and A_5.

To do this, I have so far used the "mmv" command but I still have to 
type in the directory name for each batch.  Is there a way to capture 
the directory name and place it in a variable?
I have looked at "pwd" but that gives me the whole path.

I don't mind using command line but I am not a programmer.  Any 
suggestion is welcome.

Normand


More information about the OCLUG mailing list