jmpadams Posted October 25, 2007 Posted October 25, 2007 I have an outside system that generates hundreds of folders with unique names. The group of files INSIDE each folder have the same names. For instance here is a sample of two folders with the files that are in each:http://10.131.180.203/u/user/assets/ S-CA-WILDFIRE-LAKEWOODScript.txtbroadcast.mpgpreview.jpgproxy.wmvz_metadata.xmlhttp://10.131.180.203/u/user/assets/S-FIRS...UMBO-COMMERCIALScript.txtbroadcast.mpgpreview.jpgproxy.wmvz_metadata.xmlI want to copy the broadcast.mpg from certain folders to another computer to the directory: C:\Video\ -- but, the file name needs to change to a unique name.This is how I envision it working: 1.) User navigates to the folder that contains the mpg video they need 2.) User invokes a VB script that will a. Capture the name of the current folder (e.g. S-CA-WILDFIRE-LAKEWOOD) b. Copy the broadcast.mpg file to C:\Video\ c. Rename the file S-CA-WILDFIRE-LAKEWOOD.mpgIf it helps, the file labeled z_metadata.xml includes an xml tag labeled asset_name that contains the same name as the folder. Perhaps it can be extracted.Any help would be greatly appreciated.Thanks.
gunsmokingman Posted October 26, 2007 Posted October 26, 2007 (edited) This is a example of getting just the folder name and copy a file using the folder name.Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")Dim FolderSet Folder = Fso.GetFolder(Fso.GetParentFolderName(WScript.ScriptFullName))'/-> Shows Only The Folder Name MsgBox Folder.Name,4128,"Folder Name"'/-> Check To See If The File Is There If Fso.FileExists("New Text Document.txt") Then Fso.CopyFile("New Text Document.txt"),(Folder.Name & ".txt"),True End IfHere is a link for making a dialogbox and selecting multiple files for copy.This will only work on XP machine and no other OS.Hey, Scripting Guy! Edited October 26, 2007 by gunsmokingman
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now