Relabeling all audio files on a server

Dale J. Chatham dale at chatham.org
Wed Jun 2 19:20:21 UTC 2010


Not that incredibly difficult, but when I do it, if I have space, I 
create a tarball of the directories of files to rename.

Then:

find -type f <dir> | \
while read OLDFILE
do
   NEWFILE=`convert_file $OLDFILE`
   if [ ! -f $NEWFILE ]
   then
     mv $OLDFILE $NEWFILE
   fi
done

create an appropriate "convert_file" shell function.

If it's just a matter of translating characters, pretty easy to do from 
the command line.  Heck, the shell function can be created from the 
command line and used.

Beware my typos :)



On 06/02/2010 01:13 PM, Bill Davidsen wrote:
> Tim wrote:
>    
>> On Mon, 2010-05-31 at 13:27 -0400, Bill Davidsen wrote:
>>      
>>> 1 - any mass rename opens you to disaster
>>>        
>> One fly in the ointment might be renaming one file to the same name as
>> an already existing file.
>>
>>      
> Here there be tigers ;-)
>
> I did pull out the directory name to prevent renaming that, and additional
> checks could be added to prevent the unlikely duplicate name. In general
> operations of this type are not safe, people do them because they are
> convenient. ;-)
>
>    


-- 
Our peculiar security is in the possession of a written Constitution.
Let us not make it a blank paper by construction."

    --Thomas Jefferson, letter to Wilson Nicholas, 1803

There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order.
  -- Ed Howdershelt (Author)



More information about the users mailing list