' Copy files in a list to a folder
Const OverwriteExisting = TRUE
Const ForReading = 1
sTgtPath="\\server\share\"
sSrcPath="c:\dir\file1.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
(sSrcPath, ForReading)
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
arrServiceList = Split(strNextLine , ",")
Wscript.Echo "Copying " & strNextLine & " to " & sTgtPath
objFSO.CopyFile strNextLine , sTgtPath, OverwriteExisting
Loop
@echo off
setlocal
set DestDir=H:\destdir
set FileList=file1.txt
set LogFile=copylog.txt
echo Started: %DATE% %TIME%>>"%LogFile%"
for /f "tokens=* usebackq" %%A in ("%FileList%") do (
echo Copying: "%%~A" to "%%~A">>"%LogFile%"
copy "%%~A" "%%~A"
)
echo Ended: %DATE% %TIME%>>"%LogFile%"
~bp
' Copy files in a list to a folder
Const OverwriteExisting = TRUE
Const ForReading = 1, ForWriting = 2, ForAppending = 8
sTgtPath="\\server\share\"
sSrcPath="c:\dir\file1.txt"
sLog="%temp%\copyfilesLog.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set obSrcFN = objFSO.OpenTextFile (sSrcPath, ForReading)
Set obLogFN = objFSO.OpenTextFile (sLog, ForAppending, True)
Do Until obSrcFN.AtEndOfStream
strNextLine = obSrcFN.Readline
arrServiceList = Split(strNextLine , ",")
Wscript.Echo Now & " " & "Copying " & strNextLine & " to " & sTgtPath
objFSO.CopyFile strNextLine , sTgtPath, OverwriteExisting
obLogFN.WriteLine Now & " " & strNextLine
Loop
' Copy files in a list to a folder
Const OverwriteExisting = TRUE
Const ForReading = 1, ForWriting = 2, ForAppending = 8
sTgtPath="\\server\share\"
sSrcPath="c:\dir\file1.txt"
sLog="c:\dir\copyfilesLog.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set obSrcFN = objFSO.OpenTextFile (sSrcPath, ForReading)
Set obLogFN = objFSO.OpenTextFile (sLog, ForAppending, True)
Do Until obSrcFN.AtEndOfStream
strNextLine = obSrcFN.Readline
arrServiceList = Split(strNextLine , ",")
Wscript.Echo Now & " " & "Copying " & strNextLine & " to " & sTgtPath
objFSO.CopyFile strNextLine , sTgtPath, OverwriteExisting
obLogFN.WriteLine Now & " " & strNextLine
Loop
obSrcFN.Close
obLogFN.Close
C:\temp\readncopy.vbs(19, 5) Microsoft VBScript runtime error: Permission denied
sTgtPath="c:\testfolder\"
@Bill Prew - on your batch file ...What do the lines in your text file look like, full path, or just a file name?
nothing get copys.. and when I looked at the logs it was copying from target to target
Open in new window
~bp