batch file rename

  • Thread starter Thread starter shank
  • Start date Start date
S

shank

I have a HDD with thousands of files I need to rename. There's some 600
upper level folders and 3-5 subfolders under each of those. I have all
filenames, complete with folder structure, on their own line. Some original
filenames with their file structure intact are very long. The longest being
206 characters in length.

Problem: Isn't the most characters allowed on any one line limited to 255?
(206 + maybe 206 = ouch!) Is there a way I can batch this rename project?

thanks!
 
shank said:
I have a HDD with thousands of files I need to rename. There's some 600
upper level folders and 3-5 subfolders under each of those. I have all
filenames, complete with folder structure, on their own line. Some original
filenames with their file structure intact are very long. The longest being
206 characters in length.

Problem: Isn't the most characters allowed on any one line limited to 255?
(206 + maybe 206 = ouch!) Is there a way I can batch this rename project?

thanks!

Possibly.

Why 206+206? The syntax of REN doesn't allow a destination PATH, just the
NAME - so you should be fine if your new fileNAME is <40 characters or so.

What is your setup? Do you have a file of the old names and one of the new,
or do you have one file with old and new on separate lines, or old and new
separated by spaces on one line or is there a formula you need applied to
the old name to get the new?

A few examples wouldn't go astray - but you don't need to put in
206-character names. "c:\directorystring\filename.ext" is sufficient - with
an indication of the max. length of each element.
 
I have a HDD with thousands of files I need to rename. There's some 600
upper level folders and 3-5 subfolders under each of those. I have all
filenames, complete with folder structure, on their own line. Some original
filenames with their file structure intact are very long. The longest being
206 characters in length.

Problem: Isn't the most characters allowed on any one line limited to 255?

Win9x/ME are around that - W2K is 2K and XP is 8K command line length
IIANM.

Regards,
Mic
 
billious said:
Possibly.

Why 206+206? The syntax of REN doesn't allow a destination PATH, just the
NAME - so you should be fine if your new fileNAME is <40 characters or so.

What is your setup? Do you have a file of the old names and one of the
new, or do you have one file with old and new on separate lines, or old
and new separated by spaces on one line or is there a formula you need
applied to the old name to get the new?

A few examples wouldn't go astray - but you don't need to put in
206-character names. "c:\directorystring\filename.ext" is sufficient -
with an indication of the max. length of each element. ===========================
Looks like I'm screwed anyway... That's exactly what I wanted to do. Use REN
with full paths. The idea was to rename files from the HDD root with a batch
file. The problem is that whoever created the filenames did not follow any
one set of rules. I need them to be organized and descriptive so they can be
accessed with ease and accuracy in the years to come. And there are
thousands of files buried in folders and subfolders. I really don't want to
do this manually.

thanks
 
shank said:
Looks like I'm screwed anyway... That's exactly what I wanted to do. Use
REN with full paths. The idea was to rename files from the HDD root with a
batch file. The problem is that whoever created the filenames did not
follow any one set of rules. I need them to be organized and descriptive
so they can be accessed with ease and accuracy in the years to come. And
there are thousands of files buried in folders and subfolders. I really
don't want to do this manually.

thanks

Still depends on how you are staoring or generating your old and new names.

For instance, you could

MOVE oldname_including_path_which_is_very_long 1.1
MOVE 1.1 newname_including_path_which_is_very_long

which effectively renames the file twice, and does the job.

Perhaps you should examine

XCOPY /T

to establish an empty destination tree

or you could parse a destination-filename list to generate that tree -
depends on what I've asked - how are the new and old names stored or
generated?

Processing textfiles and command-outputs is a common batch task tackled
daily in alt.msdos.batch.nt
 
Back
Top