Solved

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

Posted on 2010-11-17
13
455 Views
Last Modified: 2012-06-22
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.
0
Comment
Question by:aguisa
  • 7
  • 3
  • 2
  • +1
13 Comments
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34161013
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
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34161014
It's a really useful tool. Even supports recording macros.
0
 

Author Comment

by:aguisa
ID: 34161051
Other way of doing this and not compromising my PC with any installed software?

0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 53

Expert Comment

by:Bill Prew
ID: 34161054
Do you need to do this in MSDOS, or Linux?

~bp
0
 

Author Comment

by:aguisa
ID: 34161088
I mean something like:


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

or in linux maybe


thanks.
0
 
LVL 9

Expert Comment

by:bz43
ID: 34161096
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!
0
 

Author Comment

by:aguisa
ID: 34161116
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.
0
 

Author Comment

by:aguisa
ID: 34161119
The harddrive with the files is external USB
0
 
LVL 53

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 34161170
Here's a BAT script that should do it in Windows DOS.

@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: =!
  ren "%%A" "!NewName!%%~xA"
)

Open in new window


~bp
0
 

Author Comment

by:aguisa
ID: 34161231
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)?
0
 

Author Comment

by:aguisa
ID: 34161243
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
0
 

Author Closing Comment

by:aguisa
ID: 34161253
Usability of this Bat function is really amazing. Thanks thanks
0
 
LVL 53

Expert Comment

by:Bill Prew
ID: 34161276
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

0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question