Solved

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

Posted on 2010-11-17
13
452 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
Comment Utility
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
Comment Utility
It's a really useful tool. Even supports recording macros.
0
 

Author Comment

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

0
 
LVL 51

Expert Comment

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

~bp
0
 

Author Comment

by:aguisa
Comment Utility
I mean something like:


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

or in linux maybe


thanks.
0
 
LVL 9

Expert Comment

by:bz43
Comment Utility
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:aguisa
Comment Utility
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
Comment Utility
The harddrive with the files is external USB
0
 
LVL 51

Accepted Solution

by:
Bill Prew earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Usability of this Bat function is really amazing. Thanks thanks
0
 
LVL 51

Expert Comment

by:Bill Prew
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now