Thx for above script, works
I want to achieve a slight variation on the theme, any pointers appreciated:
where its standard to be able to set an intger counter to count asin "j += 1", what I wish to achieve is to be able to increment ascii or unicode values. So for example lets say you had digital pic DSC001.jpg, DSC002.jpg .... DSCnnn.jpg, Now lets say I wanted to create a script and be able to pass it an argument as the $1 parameter such that the file(s) would be renamed to A.jpg, B.jpg...Z.jpg, OR aa.jpg, bb.jpg...zz.jpg, or aa.jpg, ab.jpb...az.jpg., how would I achieve this? Is there a function in bash or other Linux shells which enables me to do this?
A second related (or perhaps not
) question is as follows: When you have a file in a directory which begins with a hyphen ( - ), the mv cmd fails. Normally putting quotes around the filename does the trick, however lets say you have 5 files in a dir and one is called --abc def ghi.jpg , then of course you need to use "" around it to handle the spaces, but the wildcard does not work properly.
$ cd /tmp
$ mv *.* /usr/bin/ will not work properly (* or *.*) and the --abc def ghi.jpg file will not be moved. How can I do this so that files which begin with a - and also contain spaces are moved?