Monday, May 24, 2010

How to move or rename multiple files in perl script?

I have a scipt where in i have to move all files with a given prefix, to a different directory from its existing directory, how do i rename or move the files without changing the file name but at the same time moving it to a different directory

How to move or rename multiple files in perl script?
If I understand correctly, you need to move all files that have the prefix $prefix from the folder $startFolder to the folder $endFolder.





If I were doing this, I would execute a shell command. Are you running this on a unix system? If so, then you want:


`mv $startFolder/$prefix.* $endFolder`


If it's windows/dos, you want:


`move $startFolder/$prefix.* $endFolder`

flowers for algernon

No comments:

Post a Comment