Differences

This shows you the differences between the selected revisions of the page.

script_download_files_to_same_folder 2018-02-20 script_download_files_to_same_folder 2024-07-19 (current)
Line 13: Line 13:
$mask = "*.txt" $mask = "*.txt"
-$files = $session.EnumerateRemoteFiles($remotePath, $mask, [WinSCP.EnumerationOptions]::None)+$files = $session.EnumerateRemoteFiles( 
 +·············$remotePath, $mask, [WinSCP.EnumerationOptions]::AllDirectories) 
foreach ($fileInfo in $files) foreach ($fileInfo in $files)
{ {
Line 22: Line 24:
</code> </code>
-===== Using WinSCP scripting =====+===== [[script]] Using WinSCP scripting =====
It is too complicated to implement this task with a simple [[scripting]]. If you do not want to use the .NET assembly, you can at least download the remote directory tree as is, and then flatten it locally: It is too complicated to implement this task with a simple [[scripting]]. If you do not want to use the .NET assembly, you can at least download the remote directory tree as is, and then flatten it locally:
Line 35: Line 37:
    "exit"     "exit"
for /r "%TMPPATH%" %%f in ("*.*") do move "%%f" "C:\local\path\" for /r "%TMPPATH%" %%f in ("*.*") do move "%%f" "C:\local\path\"
-rd /s /q "%TMPPATH%"+rmdir /s /q "%TMPPATH%"
</code> </code>

Last modified: by martin