1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| set objFSO = CreateObject("scripting.filesystemobject")
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim strDocsPath, strDocsPhysicalPath
Dim objFSO, objFolder, objFiles, objFile
Dim strName, strFile, strType, lngSize
' map the folder to a physical path
strDocsPath = "C:\temp\"
strDocsPathDestination = "C:\temp3\"
' create a system file object
Set objFSO = CreateObject("Scripting.FileSystemObject")
' create an object for the folder
Set objFolder = objFSO.GetFolder(strDocsPath)
' create a files collection
Set objFiles = objFolder.Files
' step through the files collection
For Each objFile in objFiles
' get a file's name
strName = objFile.Name
' make it lowercase for the URL
strFile = Lcase(strName)
' get the file's type
strType = objFile.Type
Set WshShell = wscript.createobject("wscript.shell")
objFile.Copy strDocsPathDestination
Next |