Re: file list not available in .xml log file
after running the script file using a .bat file .xml log is created but i am not able to find the file list in the log(by opening the .xml lof file)
Are you using the latest version of WinSCP?
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
after running the script file using a .bat file .xml log is created but i am not able to find the file list in the log(by opening the .xml lof file)
RequireFullFileName: True
Execute: C:\Program Files\WinSCP\WinSCP.com
Arguments: /log=[destination and .XML filename; ex. C:\transfer_log.xml] /script=[script location to call; ex. C:\sFTPList.txt]
Working Directory: <blank>
StandardInputVariable: <blank>
StandardOutputVariable: <blank>
StandardErrorVariable: <blank>
FailTaksIfReturnCodeIsNotSuccessValue: True
SuccessValue: 0
TimeOut: 0
WindowStyle: Hidden
option batch on
option confirm off
open sftp://myaccount:MyPa55word@myserver.example.com -hostkey="ssh-dss 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
# Below listing only files that have a .txt file format
ls *.txt
# Disconnect
close
exit
file1.ext
file2.ext
file3.ext
winscp.com /log=transfer_log.xml /script=myscript.txt
open sftp://myaccount:MyPa55word@myserver.example.com
ls
exit
' list_files_in_winscp_xml-log.vbs
Dim strFilename, intReturncode
Dim objArguments, objFileSystem, objXmldoc, objNodes
Set objArguments = WScript.Arguments
If (objArguments.Count = 1) Then
strFilename = objArguments(0)
Else
WScript.Echo "XML-log file name missing."
WScript.Quit(1)
End If
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
If Not objFileSystem.FileExists(strFilename) Then
WScript.Echo "XML-log file does not exist, quitting."
WScript.Quit(2)
End If
Set objXmldoc = CreateObject("MSXML2.DOMDocument")
objXmldoc.Load(strFilename)
intReturncode = objXmldoc.setProperty("SelectionNamespaces", "xmlns:w='http://winscp.net/schema/session/1.0'")
Set objNodes = objXmldoc.selectNodes("//w:file")
For Each Node in objNodes
If Node.selectSingleNode("w:type/@value").value = "-" Then
WScript.Echo Node.selectSingleNode("w:filename/@value").value
End If
Next
cscript //nologo list_files_in_winscp_xml-log.vbs transfer_log.xml > filelist.txt
file1.ext
file2.ext
file3.ext
FOR /F %A in (filelist.txt) do If Exist "\\MyServer\MyFolder\%~nxA" Echo File %~nxA exists.
Rem MyBatchscript.bat
FOR /F %%A in (filelist.txt) do (
If Exist "\\MyServer\MyFolder\%%~nxA" (
Echo File %%~nxA exists.
) Else (
Echo File %%~nxA DOESN'T exists.
)
)