Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


renaming pdf & jpeg files plus copy

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,64520
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> renaming pdf & jpeg files plus copy
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 renaming pdf & jpeg files plus copy - 9/24/2008 2:06:26 AM   
  mdfaraci

 

Posts: 1
Score: 0
Joined: 9/24/2008
Status: offline
Hello

I need to rename only pdf and jpeg files with part of the parent folders parent. In other words path example would be F:\Test\The Bronco\1904\Data\file.jpg(.pdf), I need to rename files with part of 1904. There are multiple folders under Test that this should run through  F:\Test\The Bronco\1905\Data, F:\Test\The Bronco\1906\Data, ect... Also i need to copy the jpeg in same location with different name Im not sure how close or how far away my code is from working still learning, but here it is minus the copy/move method atleast you know im trying LOL. The out come should be three files. The Bronco 1904.pdf, The Bronco 1904.pdf.jpg, The Bronco 1904 Cover.jpg (jpeg copy). Any help would be greatly appreciated i have not attempted to include code for copy yet want to get on the right track first dealing with directories and paths, renaming, thanks in advance for your help


dim fso, root, pdf, jpeg, PJName, data, folder.name, file.name
Set fso = createobject("Scripting.FileSystemObject")
Set root = fso.getfolder("F:\Test\The Bronco\")
data = "F:\Test\The Bronco\*\data"
pdf = ".pdf"
jpeg = ".jpg"
PJName =" The Bronco "
for each folder in root.subfolders
folder.name = "data.GetParentFolder.vbs"
file.name = fso.GetFiles(data)

If right(file.name,3) = ".pdf" Then
    file.name = PJName & folder.name & pdf 


  Elseif right(file.name,3) = ".jpg" Then
    file.name = PJName & folder.name & pdf & jpeg

end If

Next
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> renaming pdf & jpeg files plus copy Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts