| |
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
|
|