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-LAKEWOOD
Script.txt
broadcast.mpg
preview.jpg
proxy.wmv
z_metadata.xml
http://10.131.180.203/u/user/assets/S-FIRS...UMBO-COMMERCIAL
Script.txt
broadcast.mpg
preview.jpg
proxy.wmv
z_metadata.xml
I 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.mpg
If 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.
Page 1 of 1
Rename file using folder name
#2
Posted 26 October 2007 - 10:16 AM
This is a example of getting just the folder name and copy a file using the folder name.
Here 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!
Quote
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Folder
Set 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 If
Here 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!
This post has been edited by gunsmokingman: 26 October 2007 - 10:27 AM
- ← Retrieving data in a FOR loop for a batch file
- Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
- Suggested Sites →
Share this topic:
Page 1 of 1



Help
Back to top









