Link to home
Start Free TrialLog in
Avatar of aguisa
aguisaFlag for Costa Rica

asked on

Renaming all files (38gb :) in a folder and subfolders with one command?

Hi experts

I need to rename all files in folders/subfolders in the following way:

every space should be removed from its name.

there are names like:

gastro de manuel solis.bmp
2020 examen de videoscopia rectal.bmp

etc.

thanks.

There are about 500000 of thes files.

Bye.
Avatar of TommySzalapski
TommySzalapski
Flag of United States of America image

I would just download Oscar's Renamer and do a find/replace and replace a space with nothing.
http://www.mediachance.com/free/renamer.htm
It's a really useful tool. Even supports recording macros.
Avatar of aguisa

ASKER

Other way of doing this and not compromising my PC with any installed software?

Avatar of Bill Prew
Bill Prew

Do you need to do this in MSDOS, or Linux?

~bp
Avatar of aguisa

ASKER

I mean something like:


ren | more | dir /s |. .....

or in linux maybe


thanks.
What is the OS that the files are on?  Then we can create a command line tool for you.  If it's MS-DOS then which version.  If it's Windows 7 but you want to use the command line let us know.  Thanks!
Avatar of aguisa

ASKER

I have Windows XP Media Center SP3, and UBUNTU 10.10

Either the first or the second would be fine,

both would be greatly appreciated, just for the records and by the way,

thanks.
Avatar of aguisa

ASKER

The harddrive with the files is external USB
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aguisa

ASKER

No bp, i get the following :


The system cannot find the file specified.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
^CTerminate batch job (Y/N)?
Avatar of aguisa

ASKER

wait....



it worked like magic, and actually in 5 seconds,

the error was for the non containing blanks case.


BP is a genius undoubtedly. Thanks alot
Avatar of aguisa

ASKER

Usability of this Bat function is really amazing. Thanks thanks
Great, glad that was helpful.  If you wanted to only rename when the filename changed, this change would handle that.

~bp

@echo off
setlocal EnableDelayedExpansion
set BaseDir=c:\temp
for /F "tokens=*" %%A in ('dir /a-d /s/b "%BaseDir%"') do (
  set OldName=%%~nA
  set NewName=!OldName: =!
  if "!OldName!" NEQ "!NewName!" ren "%%A" "!NewName!%%~xA"
)

Open in new window