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
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' ====================
'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
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
Set SubFolders = rootFolder.SubFolders
For Each Folder In SubFolders
' Copy all files in this subfolder
Set objFSO = Nothing
==================== end contents of 'copyall.vbs' ====================
You can also download this vbs file from here:
To execute this file, follow these steps:
- In the StartMenu > Run dialog, type
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>
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!