bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how do I write a shell script to batch rename files in a directory?


From: ONYTZ
Subject: Re: how do I write a shell script to batch rename files in a directory?
Date: Fri, 29 Aug 2008 15:18:29 -0700 (PDT)

Thanks, all! 

>From a private post (sorry about my breach of etiquette...) Bob Proulx
suggested:

>  for i in *.gif?; do echo mv --verbose -- "$i" ${i%?}; done

Which echoed the response I wanted. I had tried one of the previous
suggestions and I got some puzzling output:

>> mv: `img.bc05.101.3.gif\r' and `img.bc05.101.3.gif\r' are the same file
>>
>> Though when I ls the directory, I get, for example
>>
>> img.bc05.101.3.gif?

Bob Proulx pointed out that:

> the filename is really "img.bc05.101.3.gif\r" instead where "\r" is a
> carriage return character.  The ls program is converting the
> non-printable character into a ? for display. 



-- 
View this message in context: 
http://www.nabble.com/how-do-I-write-a-shell-script-to-batch-rename-files-in-a-directory--tp19227042p19228305.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]