Manufacturing Information Solutions Forum Index Manufacturing Information Solutions
Your Place for Support and Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Automatically redame all files to sequential numbers

 
Post new topic   Reply to topic    Manufacturing Information Solutions Forum Index -> VB Script
View previous topic :: View next topic  
Author Message
mistux
Site Admin


Joined: 25 Jun 2004
Posts: 1042
Location: South Bend, Indiana USA

PostPosted: Mon Oct 09, 2006 9:40 pm    Post subject: Automatically redame all files to sequential numbers Reply with quote

Here is a vbs script that will rename all the files to numbers. Just copy this code below into a blank text file and name is something like rename.vbs
Code:

If Wscript.Arguments.count <= 0 Then
   Wscript.echo "Please provide a folderpath as the first argument."
     Wscript.Quit 1
end if

Trim(Wscript.arguments.item(0))
set fs = CreateObject("Scripting.FileSystemObject")
folder_name = Trim(Wscript.arguments.item(0))

set objFolder = fs.GetFolder(folder_name)

upperlimit = 999999.0
lowerlimit = 0.0

For Each objFile In objFolder.Files
   newfilename = fs.GetFileName(objFile.path)
   do
   newfilename = (Int((upperlimit - lowerlimit + 1)*Rnd() + lowerlimit)) & right(newfilename, len(newfilename) - instrrev(newfilename, ".")+1)
   Loop Until not fs.fileexists(folder_name & "\" & newfilename)
   fs.movefile objFile.path, folder_name & "\" & newfilename
next

Wscript.echo "Done"

Now just drag and drop the folder with all the images in it onto this vbs file and it should rename them for you.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Manufacturing Information Solutions Forum Index -> VB Script All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group