Re: How to get and delete files from multiple directories and subdirectories
There's no easy solution for this using WinSCP scripting.
All you can do is using plain
See https://winscp.net/eng/docs/guide_interpreting_xml_log
Though easier is to use PowerShell script with WinSCP .NET assembly.
- Do a regular download = do not set
- Iterate
- For each successful download of a file, call
References:
https://winscp.net/eng/docs/library_session_getfiles
https://winscp.net/eng/docs/library_transferoperationresult
https://winscp.net/eng/docs/library_session_removefiles
All you can do is using plain
get
with enabled XML logging. After the download finishes, parse the XML log to find a list of downloaded files and generate delete script for these.
See https://winscp.net/eng/docs/guide_interpreting_xml_log
Though easier is to use PowerShell script with WinSCP .NET assembly.
- Do a regular download = do not set
remove
parameter of Session.GetFiles
to true.
- Iterate
TransferOperationResult.Transfers
returned by the Session.GetFiles
.
- For each successful download of a file, call
Session.RemoveFiles
.
References:
https://winscp.net/eng/docs/library_session_getfiles
https://winscp.net/eng/docs/library_transferoperationresult
https://winscp.net/eng/docs/library_session_removefiles