| Liam Delahunty: Home | Tips | Web | Contact | 
|---|
| 
 
Recommended laptop 
under £500. Think I deserve a present? See my Amazon Wish List  | 
   
Linux - Renaming FilesRenaming multiple files in a single directoryI tried the following "script" in a shell... 
with the intention of renaming all the files in a folder from .php to .php... WRONG Instead, I now have *.phpp (BTW I repaired my error with rename phpp php *.phpp) This would have worked: for file in *.php do mv $file `basename $file .php`.php done ...or... for i in *.php; do mv "$i" `echo "$i" | sed 's/\.php3$/.php/'`; done
Please also see how-to rename a single file or a directory 
 Share this!  |