Jump to content

Recommended Posts

Posted

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.


Posted (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 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!

Edited by gunsmokingman

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...