Copying files from multiple folders to a single folder.

  • Thread starter Thread starter vemula4u@gmail.com
  • Start date Start date
V

vemula4u@gmail.com

Guest
Hi can some one help me in debugging the follwing script.
I am copying the files whouse location is given ina text file ie.
coomputerlist.txt to a folder d:\archive.I am reading the contents of
the
file from where i will pick the source location of the file.all the
files
here are located at different folders.
when iam running the script iam getting an error: filenot found.I
think it
is unable to read the source file in the methord objFSO.CopyFile
filename
"D:\Archive\"
which in a variable filename.
can some help me its very urgent.

Dim filename
Const OverwriteExisting = True
Const inputfile = "c:\computerlist.txt"
Set ifso = CreateObject("Scripting.Filesystemobject")
Set ifile = iFSO.OpenTextFile(inputfile)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Do until ifile.AtEndOfLine
Filename = ifile.ReadLine
objFSO.CopyFile filename "D:\Archive\"
Loop
 
Back
Top