Calling all gurus!

Naming files issue...

Monday, August 20, 2007 by RPGFX | Discussion: Personal Computing

Hello wonderful folks of WC! Was just wondering if anyone out there knew if there was a way to rename multiple files all at once. I have a folder full of pictures, all with various different names, and I'll like to rename them 0001 through 0500 (or however many there are) without individually renaming hundreds of files. I know if you highlight them all and right click and rename, I can give them all the SAME name with (2) after it, but that's not what I'm going for here. Any clues?
SirSmiley
Reply #1 Monday, August 20, 2007 4:20 PM
Directly from Windows there is no way. Either use a script or search for File Renaming freeware.
RomanDA
Reply #2 Monday, August 20, 2007 4:56 PM
you dont care about the existing names? you just want everything in the folder to be named 0001 - 0500.jpg?

I might be able to make a simple widget to drop a folder onto and have all the files renamed, but i have not looked into the "rename" in the fso object. It really doesnt sound hard.

1. read the folder
2. get a list of all the file names - put them in an array
3. start a counter at 0001
4. rename the files and update the counter for each file.

Let me know if your interested.
Lantec
Reply #3 Monday, August 20, 2007 5:09 PM
I used a freebie called A.F.5 Renamer before I got Adobe Lightroom. Just the thing for renaming photos. You can get it HERE
Island Dog
Reply #4 Monday, August 20, 2007 5:38 PM
This is what I use.  It has a variety of other features aside from batch renaming as well.

http://www.faststone.org/FSResizerDetail.htm

 
NightTrainthedark
Reply #5 Monday, August 20, 2007 5:45 PM
1. read the folder
2. get a list of all the file names - put them in an array
3. start a counter at 0001
4. rename the files and update the counter for each file.


That is a widget that could be of some use. I am wondering if it could also name file extensions at the same time. Example.. From .PSD to .PNG, etc.   
RomanDA
Reply #6 Monday, August 20, 2007 6:06 PM

well i was playing..

1. got it to read a "set" folder
2. got it to read the list of files
3. added a counter to make the new file names
4. have it check for ".jpg" files (for this example)
5. renames the old file to 0001.jpg up to 9999.jpg

Works pretty good, crappy interface but it works. (right now its just a text listing).

The code was pretty simple: (again i have HARD-CODED the folder for testing)
All of this is in a simple TEXT object.

Code: vbscript
  1. Sub Object_OnScriptEnter
  2. path = "d:\renameme"
  3. object.text = "reading.." & vbnewline
  4. Set filesys = CreateObject("Scripting.FileSystemObject")
  5. Set TargetFolder = filesys.GetFolder(Path)
  6. Set FolderFiles = TargetFolder.Files
  7. cnt = 0
  8. For Each OldFileName In FolderFiles
  9. cnt = cnt +1
  10. If UCase(right(OldFileName,3)) = "JPG" Then
  11. If cnt < 10 Then NewFileName = "000" & cnt & ".jpg"
  12. If cnt => 10 And cnt < 100 Then NewFileName = "00" & cnt& ".jpg"
  13. If cnt => 100 And cnt < 1000 Then NewFileName = "0" & cnt& ".jpg"
  14. NewFileName = Path & "\" & NewFileName
  15. object.text = object.text & OldFileName & " to " & newfilename
  16. filesys.MoveFile OldFileName, newfilename
  17. object.text = object.text & " -- RENAMED " & vbnewline
  18. End If
  19. Next
  20. End Sub


It would make more sense to move the new files to a "renamed" folder or something.
Im sure it could be tweeked to do a lot of things.

There are a lot of "renamers" out there (did a search) so i dont know how much time to spend on this. But the code is here.

 

// Edited by andrew_; Pasted the code from the correction reply to fix the code block.

RPGFX
Reply #7 Monday, September 3, 2007 11:01 AM
Let me know if your interested.


certainly something I would love to have! And I'm sure others would love it too... thanks for offering your services, would love to see it produced!
RomanDA
Reply #8 Monday, September 3, 2007 11:39 AM
I will have to see what i can do. IT seems to work as it is (hardcoded) but its kind of a strange program, not a lot of people will want to globally rename all their files.
ama02
Reply #9 Monday, September 3, 2007 5:30 PM
Irfanview has a batch process/rename feature which I've used in the past...it's easy and works well for what I need.

...but that would be cool if RomanDA could custom make one.   
Xanza666
Reply #10 Monday, September 3, 2007 7:14 PM
lol wow... You guys call yourselves Guru's... Windows will rename any number of files that your computer can handle... Just select all in the directory, and just friggin hit F2.. Name it something like: 1.jpg... Then all the other files will be: 1(1).jpg, 1(2).jpg... ext.
GH33DA
Reply #11 Monday, September 3, 2007 8:22 PM
I surprised Roman didn't post a widget.
RomanDA
Reply #12 Tuesday, September 4, 2007 7:44 AM
Roman has been working.. thats why.. And im kind of leary of posting "rename" or "move" widgets as there is a LOT of potential for losing files..

The File Transporter was to have a copy/move built into it, but i had it nuke a file of mine when it was to "move" it and something wasn't correct, so.. i just got rid of those functions.

The code above works, and could be made into a widget without a ton of work. but as its been pointed out here, there are other ways to do this, and im not a huge fan of re-creating the wheel. I like to do things not already done.
XX
Reply #13 Wednesday, September 5, 2007 10:01 AM
Yeah. It's same for me. That's why I rarely make skins and stuff. XXCalc and XXLog was unique in its era.
RPGFX
Reply #14 Wednesday, September 5, 2007 12:22 PM
lol wow... You guys call yourselves Guru's... Windows will rename any number of files that your computer can handle... Just select all in the directory, and just friggin hit F2.. Name it something like: 1.jpg... Then all the other files will be: 1(1).jpg, 1(2).jpg... ext.


maybe you should read my original post again before blasting all these nice people trying to help me...

I know if you highlight them all and right click and rename, I can give them all the SAME name with (2) after it, but that's not what I'm going for here.


r7yea
Reply #15 Wednesday, September 5, 2007 3:17 PM
I use RN 1-4a rename (FREE)

Read all about it HERE

Robert

Please login to comment and/or vote for this skin.

Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:

  • Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
  • Access to a great community, with a massive database of many, many areas of interest.
  • Access to contests & subscription offers like exclusive emails.
  • It's simple, and FREE!



web-wc01