Filename conversion
Jing Su
jingsu-26n5VD7DAF2Tm46uYYfjYg at public.gmane.org
Sun Apr 11 15:11:21 UTC 2004
You can deal with spaces by using an escape character.
eg:
ls Set1\ 00?.png
You can also do a simple bash loop to rename all of them to strip the
space.
eg:
for file in Set1*; do mv "$file" Set1${file##Set1\ }; done
The above will rename all file like "Set1 001.png" to "Set1001.png"
Note that the quotes around $file are important, to preserve the space
as part of the filename when $file gets expanded.
-Jing
On Sun, 11 Apr 2004, John Wildberger wrote:
> Date: Sun, 11 Apr 2004 07:47:29 -0400
> From: John Wildberger <wildberger-iRg7kjdsKiH3fQ9qLvQP4Q at public.gmane.org>
> Reply-To: tlug-lxSQFCZeNF4 at public.gmane.org
> To: tlug <tlug-lxSQFCZeNF4 at public.gmane.org>
> Subject: [TLUG]: Filename conversion
>
> I imported from an XP OS a number of files into Linux. These files have names
> like "Set1 001.png" with a space beteen the Set1 and 001.png. These are
> picture files and can be displayed by by GIMP without a hitch inspite of the
> space char.
> However, anything else I want to do with these files fails due to the presence
> of the space. Any individual file can be renamed without problems, thereby
> eliminating the space char. However, this is quite cumbersome if there are a
> great number of files.
> Question: Is there an efficient way (perl ??) to deal with this for all such
> files in a particular directory?
> John
> --
> The Toronto Linux Users Group. Meetings: http://tlug.ss.org
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
>
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list