| View previous topic :: View next topic |
| Author |
Message |
hugo929

Joined: 27 Oct 2006 Posts: 6163 Location: China
|
Posted: Wed Feb 03, 2010 12:00 pm Post subject: help! replace spaces in file name with underscore |
|
|
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 |
|
 |
JAC

Joined: 24 Jul 2005 Posts: 3469
|
Posted: Wed Feb 03, 2010 12:06 pm Post subject: |
|
|
| There are lots of auto renaming file tools. I dont know what OS you are using, so use Google. |
|
| Back to top |
|
 |
hugo929

Joined: 27 Oct 2006 Posts: 6163 Location: China
|
|
| Back to top |
|
 |
Marcin

Joined: 02 Jan 2005 Posts: 8519 Location: Poland
|
Posted: Wed Feb 03, 2010 1:00 pm Post subject: |
|
|
I use total commander and serach and replace function. Check if that works for you. _________________ Visit ABC CPU - Virtual CPU Museum. |
|
| Back to top |
|
 |
g0b

Joined: 18 Jul 2006 Posts: 1385 Location: France
|
Posted: Wed Feb 03, 2010 2:43 pm Post subject: |
|
|
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 |
|
 |
Windmiller

Joined: 24 Jun 2005 Posts: 1716 Location: Chapel Hill, NC
|
Posted: Wed Feb 03, 2010 3:37 pm Post subject: |
|
|
| 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 |
|
 |
hugo929

Joined: 27 Oct 2006 Posts: 6163 Location: China
|
Posted: Thu Feb 04, 2010 8:55 am Post subject: |
|
|
thanks for all your guy's kind help.
I finally succeeded to fix the problem by writing a small dos codelet
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 |
|
 |
|