How to modify the names of files and replace characters with other characters or symb
Hi, Does anyone have a script which does the following please:
Say you have a directory with files some of which you wish to change their name because perhaps they contain unwanted symbols like ~ , e.g. ~200005_tom_Berry_8.jpg . Lets say I want to replace the ~ with x and _ with - --> x200005-tom-Berry-8.jpg . Ideally I would like to run the script from CWD and apply it to all the sub-directories (or use the find..-exec )in that filesystem, and not only be able to change the names of files but any directory names which match the criteria, however so long as I can do it an individual dir that will be fine for now. Any ideas welcome. TIA. |
for i in *.jpg
do mv $i $(echo $i | tr '~' 'x' | tr '_' '-') done |
Thanks a lot for your suggestion, I will try it :)
|
All times are GMT -5. The time now is 12:59 PM. |