Solved

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

Posted on 2010-11-17
13
458 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 54

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 54

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 54

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

726 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