14 Nov
2013
14 Nov
'13
13:34
On Thu, 14 Nov 2013 22:00:53 +1100 Basil Chupin wrote:> > Many thanks for this, Carl! You're welcome! > Something which works! But with qualifications. > > I cried and gnashed my teeth because the above failed to work - until > I decided to try it in oS 12.3 and not the 13.1 I have been using for > quite some time. > > In 12.3 the above works - in 13.1 it doesn't: all generated files > have 0 bytes. I've only relatively recently completely tamed 12.3 here. I need to restrain myself because it's my workhorse. :-) You're probably still taming 13.1 there. Give it time. ;-) > But even in 12.3 there is a vital requirement: the file names cannot > have blank spaces in them. That is, Men At Work will not be processed > (No such file or directory) but Men_At_Work, for example, will get > converted. I don't do file names with spaces in them. :-) Sorry I forgot about that scenario. It was late... > And lastly, but not a show-stopper, is that '.mp3' is appended to the > name of the .flv file so that the new name comes out as > Men_At_Work.flv.mp3. > > Thanks again for the above script. > > (And now to go thru ~200 files and rename them not to have any blanks > in their name :-) .) Here's the solution I found for the *.flv.mp3 --> .mp3 problem. You certainly don't need to do this job by hand! Place it in your ~/bin, (chmod it you already know) and invoke it in the directory with the offending double extensions. - - - - - 8< - - - - - > #!/bin/bash > # rfe.sh: Renaming file extensions. > # > # rfe old_extension new_extension > # > # Example: > # To rename all *.gif files in working directory to *.jpg, > # rfe gif jpg > > > E_BADARGS=65 > > case $# in > 0|1) # The vertical bar means "or" in this context. > echo "Usage: `basename $0` old_file_suffix new_file_suffix" > exit $E_BADARGS # If 0 or 1 arg, then bail out. > ;; > esac > > > for filename in *.$1 > # Traverse list of files ending with 1st argument. > do > mv $filename ${filename%$1}$2 > # Strip off part of filename matching 1st argument, > #+ then append 2nd argument. > done > > exit 0 - - - - - 8< - - - - - regards, Carl -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org