Hi andywalldesign-ga,
I have written a quick VBScript to copy all the files from a source
folder (and its subfolders) to a destination folder. Note that if a
file with the same name exists in the destination folder, it will be
overwritten.
The vbscript code to do this follows below. Copy and paste this
code into a text file, and rename it 'copyall.vbs'.
====================== contents of 'copyall.vbs' ====================
Dim objFSO
'Read in the command line arguments
Set ArgObj = WScript.Arguments
searchInFolder = ArgObj(0)
copyToFolder = ArgObj(1)
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Copy all files in the root folder
CopyFolder(searchInFolder)
Sub CopyFolder(strFolderName)
Set rootFolder = objFSO.GetFolder(strFolderName)
Set fileCollection = rootFolder.Files
WScript.echo(" Looking inside folder '" +rootFolder.path+"' for
files to copy...")
For Each file in fileCollection
WScript.echo(" Copying '" +file.Name+"' to "+copyToFolder)
objFSO.CopyFile strFolderName+"\*" , copyToFolder, true
Next
Set SubFolders = rootFolder.SubFolders
For Each Folder In SubFolders
' Copy all files in this subfolder
CopyFolder(Folder.Path)
Next
End Sub
Set objFSO = Nothing
==================== end contents of 'copyall.vbs' ====================
You can also download this vbs file from here:
http://rapidshare.de/files/33945473/copyall.vbs.html
To execute this file, follow these steps:
- In the StartMenu > Run dialog, type
cmd
and press enter. This will start the command prompt.
- At the command prompt, go to the folder in which you have kept 'copyall.vbs'
- Now type the following:
cscript copyall.vbs <source folder> <destination folder>
For eg.:
cscript copyall.vbs C:\myfonts\ D:\allfonts
This will copy all the files in the myfonts folder and its
subfolder, into the allfonts folder.
Hope this helps!
If you need any clarification or help in getting the script to run
properly, just ask!
Regards,
Theta-ga
:) |