Differences

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

library_example_moves_files_keeping_directory_structure 2019-05-24 library_example_moves_files_keeping_directory_structure 2023-11-15 (current)
Line 29: Line 29:
                UserName = "user",                 UserName = "user",
                Password = "mypassword",                 Password = "mypassword",
-                SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..."+                SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx..."
            };             };
Line 80: Line 80:
==== [[upload_powershell]] PowerShell ==== ==== [[upload_powershell]] PowerShell ====
 +
 +You can install this script as an [[extension|WinSCP extension]] by using this page URL in the //[[ui_pref_commands#extensions|Add Extension]]// command.
<code powershell - UploadDeleteKeepStructure.ps1> <code powershell - UploadDeleteKeepStructure.ps1>
# @name        Upload and Delete Files # @name        Upload and Delete Files
# @command      powershell.exe -ExecutionPolicy Bypass -File "%EXTENSION_PATH%" ^ # @command      powershell.exe -ExecutionPolicy Bypass -File "%EXTENSION_PATH%" ^
-#                  -sessionUrl "!S" -remotePath "!/" -sessionLogPath "%SessionLogPath%" ^+#                  -sessionUrl "!E" -remotePath "!/" -sessionLogPath "%SessionLogPath%" ^
#                  -pause !& #                  -pause !&
# @description  Moves selected local files to a remote directory, ^ # @description  Moves selected local files to a remote directory, ^
#                  but keeps local directory structure #                  but keeps local directory structure
# @flag        ApplyToDirectories # @flag        ApplyToDirectories
-# @version      4+# @version      5
# @homepage    ~~SELF~~ # @homepage    ~~SELF~~
-# @require      WinSCP 5.12+# @require      WinSCP 5.16
# @option      SessionLogPath -config sessionlogfile # @option      SessionLogPath -config sessionlogfile
# @optionspage  ~~SELF~~#options # @optionspage  ~~SELF~~#options
Line 98: Line 100:
    # Use Generate Session URL function to obtain a value for -sessionUrl parameter.     # Use Generate Session URL function to obtain a value for -sessionUrl parameter.
    [Parameter(Mandatory = $True)]     [Parameter(Mandatory = $True)]
-    $sessionUrl = "sftp://user:mypassword;fingerprint=ssh-rsa-xx-xx-xx@example.com/",+    $sessionUrl = "sftp://user:mypassword;fingerprint=ssh-rsa-xxxxxxxxxxx...@example.com/",
    [Parameter(Mandatory = $True)]     [Parameter(Mandatory = $True)]
    $remotePath,     $remotePath,
Line 200: Line 202:
===== [[download]] Download ===== ===== [[download]] Download =====
-For a download, you can use the code from the [[library_example_recursive_download_custom_error_handling#tree_download|Explicit Implementation of a File Tree Download section of Recursively download directory tree with custom error handling]] example.+For a download, you can use the code from the [[library_example_recursive_download_custom_error_handling#tree_download|Explicit implementation of a file tree download section of Recursively download directory tree with custom error handling]] example.
Just pass a ''true'' to the optional ''[[library_session_getfiles#remove|remove]]'' parameter of the ''[[library_session_getfiles|Session.GetFiles]]''. Just pass a ''true'' to the optional ''[[library_session_getfiles#remove|remove]]'' parameter of the ''[[library_session_getfiles|Session.GetFiles]]''.
Line 207: Line 209:
<code csharp> <code csharp>
-string remoteFilePath = RemotePath.EscapeFileMask(fileInfo.FullName); +session.GetFiles(remoteFilePath, localFilePath, true).Check();
-session.GetFiles(remoteFilePath, localFilePath, true);+
</code> </code>
Line 214: Line 215:
<code powershell> <code powershell>
-$remoteFilePath = [WinSCP.RemotePath]::EscapeFileMask($fileInfo.FullName) +$session.GetFiles($remoteFilePath, $localFilePath, $True).Check()
-$session.GetFiles($remoteFilePath, $localFilePath, $True)+
</code> </code>

Last modified: by martin