|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
copying files multiple folders to single folder
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
Show quote
"Vemula" <Vem***@discussions.microsoft.com> wrote in message I'd suggest that you add code to determine exactly what has been read into news:8F570640-B8C8-4D4D-A2DD-86F984A49CDC@microsoft.com... > Hi can some one help me. > 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 the variable, perhaps something like: wscript.echo "[" & filename & "]" It could be, for example, that the filenames listed in the text file have a stray blank character on the end, or that the path is not fully qualified. /Al Show quote > objFSO.CopyFile filename "D:\Archive\" > Loop |
|||||||||||||||||||||||