help! replace spaces in file name with underscore

Post new topic   Reply to topic    CPU-World.com forums Forum Index -> Off Topic
View previous topic :: View next topic  
Author Message
hugo929



Joined: 27 Oct 2006
Posts: 6163
Location: China

PostPosted: Wed Feb 03, 2010 12:00 pm    Post subject: help! replace spaces in file name with underscore Reply with quote

for example the file name: AMD 1820 7609 29000 30GC.jpg
may have at least one space in it.
how to write the script to replace the space in the file name with underscore ?
that is:
AMD 1820 7609 29000 30GC.jpg
--->
AMD_1820_7609_29000_30GC.jpg

attention: the space numbers may varies.

thanks for your help in advance.

_________________
My vintage CPU collection:www.cpumuseum.com
Chinese Forum: http://www.cpumuseum.com/forum
Back to top
View user's profile Send private message   Visit poster's website
JAC



Joined: 24 Jul 2005
Posts: 3469

PostPosted: Wed Feb 03, 2010 12:06 pm    Post subject: Reply with quote

There are lots of auto renaming file tools. I dont know what OS you are using, so use Google.
Back to top
View user's profile Send private message  
hugo929



Joined: 27 Oct 2006
Posts: 6163
Location: China

PostPosted: Wed Feb 03, 2010 12:07 pm    Post subject: Reply with quote

DOS console window in vista
_________________
My vintage CPU collection:www.cpumuseum.com
Chinese Forum: http://www.cpumuseum.com/forum
Back to top
View user's profile Send private message   Visit poster's website
Marcin



Joined: 02 Jan 2005
Posts: 8519
Location: Poland

PostPosted: Wed Feb 03, 2010 1:00 pm    Post subject: Reply with quote

I use total commander and serach and replace function. Check if that works for you.
_________________
Visit ABC CPU - Virtual CPU Museum.
Back to top
View user's profile Send private message [ Hidden ] Visit poster's website
g0b



Joined: 18 Jul 2006
Posts: 1385
Location: France

PostPosted: Wed Feb 03, 2010 2:43 pm    Post subject: Reply with quote

Lupas rename works pretty well for me. It has a GUI, is straightforward to use and has preview functions.

g0b

_________________
Life is a long lesson in humility
Back to top
View user's profile Send private message   MSN Messenger
Windmiller



Joined: 24 Jun 2005
Posts: 1716
Location: Chapel Hill, NC

PostPosted: Wed Feb 03, 2010 3:37 pm    Post subject: Reply with quote

Marcin wrote:
I use total commander and serach and replace function. Check if that works for you.


Total Commander is a very useful application.
Back to top
View user's profile Send private message [ Hidden ]
hugo929



Joined: 27 Oct 2006
Posts: 6163
Location: China

PostPosted: Thu Feb 04, 2010 8:55 am    Post subject: Reply with quote

thanks for all your guy's kind help.

I finally succeeded to fix the problem by writing a small dos codelet Wink

Here is it:


for /f "tokens=1,2,3,4,5,6,7 delims= " %%A in ('dir/b *.jpg') do (
IF "%%B"=="" (rem
)else IF "%%C"=="" (ren "%%A %%B" %%A_%%B
)else IF "%%D"=="" (ren "%%A %%B %%C" %%A_%%B_%%C
)else IF "%%E"=="" (ren "%%A %%B %%C %%D" %%A_%%B_%%C_%%D
)else IF "%%F"=="" (ren "%%A %%B %%C %%D %%E" %%A_%%B_%%C_%%D_%%E
)else IF "%%G"=="" (ren "%%A %%B %%C %%D %%E %%F" %%A_%%B_%%C_%%D_%%E_%%F
)
)

_________________
My vintage CPU collection:www.cpumuseum.com
Chinese Forum: http://www.cpumuseum.com/forum
Back to top
View user's profile Send private message   Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    CPU-World.com forums Forum Index -> Off Topic All times are GMT - 5 Hours
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Powered by phpBB © 2001 phpBB Group