Discussion Locked

rename files

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Suppose I have many files which names are like:

990323 sth sth
990568 sth sth
990898 sth sth

suppose there are thousands of files like that. These are in a folder and I would like to rename them, not one by one, but automatically to something like:

995323 sth sth
995568 sth sth
995898 sth sth

I mean, replacing "0" by "5" in the middle of the first part of these names. Remember the files name are longer names of Windows.
How could I proceed to the name changing of these files, without having to make it one by one thousands of time by hand.
I accept any suggestion including using delphi or any other resource of the Windows.

5 replies

by ageervc

You can accomplish what you want to do using the DOS ren command. (I made up as set of dummy files (5) and tested it.)
Start/Programs/MS-DOSprompt
Change to the folder containing the files.

ren ???*.* ??5*.*

This assumes you want 5 in the 3rd position of all file names.
For your files they will appear similiar to 990323~1, etc. I used names like yours and it worked fine.
The above technique will work to change and of the first 6 positions.

by ruturaj

The above solution will work with 8.3 filenames or the first 6 characters of long file names if you want to go a step further use "" to enc your file names
eg.

ren "99????*" "99????X*"
The above statement will replace the space (sixth character) with the letter X you can use the wildcard character ? till any number of character that you actually want to replace.

(If you have the actual file names and the character you want to replace send it to me & I'll write a batch file to do the same and e-mail it back to you)

Regards :)

This discussion is closed to new replies.