ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

File Renaming question

(1/2) > >>

sajman99:
I need help to increment/decrement file names ranging from 7001-7100. Note that I don't have a complete continous set of 7001-7100 but only have some of the files (ie. 7005, 7006, 7009, 7012...).

I like and use both ReNamer and Ken Rename. In both apps there is a serialize mode which allows the user to start at a specific number and then sequence from there, but AFAIK that only works if there is a continuous set of files.

All I want to accomplish is to leave what I already have and decrement everything by a value of 1. So for example, decrementing 7005 becomes 7004, 7012 becomes 7011, etc.

Does anybody know how to accomplish this task with any software? btw I know I can do it manually one file at a time but that takes lots of time when dealing with many files.

AndyM:
I'd cobble together a one-time batch file (DecRename.bat), one line per file:

rename file7005 file7004
rename file7006 file7005
rename file7009 file7008
rename file7012 file7011
etc

Lot's of ways to make the batch file.
- Get a list of the current files, from a command prompt "dir>filelist.txt"
- Edit filelist.txt to get just a list of filenames.
- Paste the list into a column in Excel.  Use a formula to decrement the file number (easy if it's always the same two digits) in another column.  In a third column use a concatenation formula:  +"rename "&firstcolumncell&" "&secondcolumncell  
- Copy the third column and paste it into DecRename.bat
- Run DecRename.bat in the directory with the files  

If you can quickly edit the filelist and do the stuff in Excel this shouldn't take long if the filenumbers are always the same distance from the end of the filename string.  If the files are in numerous multiple folders you could generate a list with full paths using something different than the dir command.

This occurred to me first.  There's probably an easier way...

MilesAhead:
Bulk Rename Utility has a regular expression facility but I'm not sure if you can do math on the matches to do the increment/decrement.

Only thing I'd say, if you use a script or batch, is for a decrement run, make sure to sort low to high and start with the lowest number and end with the highest.  The reverse for an increment run. IOW the sequence of processing should avoid overwriting existing files(obvious true, but easy to forget once you start messing with the implementation.)

If the filenames are actual numbers only then it should be pretty easy to get a directory listing and do a sort by various means as AndyM suggested.

Target:
what's the file naming convention here - do we assume the files are all named 7XXX.XTN, or is there some other convention involved?

Are they all in a single folder?

in subfolders?

sajman99:
Actually it was a hypothetical just so I can try to understand the concept. :-[ But let's say the file names are all 4 digits beginning with 7--in the range of 7001 and 7100 /.jpgs in the same folder.

Navigation

[0] Message Index

[#] Next page

Go to full version