And another approach, that's similar.
Main Topics
Browse All TopicsI need a small script to rename the bulk of files in particular format.
file is like this
ABC-4-Nov-09.04.51.36.txt
and it needs Renamed to
ABC_04.txt
Note that the number has to be 2 figures
ie 04 and not 4.
i have the following code
But it needs a small change
1) 'strCurrentFolder = "G:\\kamaraj\\YYYY\\MMM\\"
2) wscript.echo objFile - instead of that i need a logic to rename the file
i know we can rename the file using objFSO.MoveFile objFile.Path, strcurrentfolder & NewFileName
please help
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Showing the file name before and after renaming is easy enough, but I don't see how to determine whether the rename was successful or not. With very few exceptions the file is going to be renamed even if the resulting name is wrong. It's easy for you and I with our human intelligence to see that a file name didn't come out right. That's because our brains are great at pattern recognition. I can have the script see if the new file name matches the pattern of three letters followed by an underscore followed by two digits, but that doesn't mean the file name is correct. If the input file name was "ABC-9-adfaf.txt" and the renamed file came out as "BAC_90" that test would report success even though the name is clearly wrong. The only failure the script can readily detect is if the input file name doesn't match the required pattern. The pattern for input is 3 letters dash 1 number dash 3 letters dash some numbers and periods. The key is the first two segments of the name separated by a dash. I can have the script check to make sure that those two segments exist and are the right type and length. Testing the new name seems impossible since there's really nothing to test it against.
Business Accounts
Answer for Membership
by: moagriusPosted on 2009-11-04 at 11:37:32ID: 25743010
this should do it - folder is supplied through a prompt
Select allOpen in new window