1

I couldn't find in the Auto Synchronization of folders the option to copy files from sub-folder without copying the full folder structure into the root of remote location.

Is something I'm missing or is there a way that I can achieve this with some turnaround at least?

example

local/folder1/file1.wav
local/folder2/file2.wav
local/folder2/file3.wav
local/folder2/file4.wav
local/folder3/file5.wav

into

root/file1.wav
root/file2.wav
root/file3.wav
root/file4.wav
root/file5.wav

2 Answers2

0

WinSCP doesn't have such an interface.

The options I can see are:

harrymc
  • 480,290
  • Hey yes! I did find a script but would like to improve it on an automation basis.. Here is the code I found. Is there a way to do this on automation every time a new file is on the local folder? > https://stackoverflow.com/questions/70990061/ftp-winscp-synchro-local-files-in-local-subfolders-to-roots-remote-without – Rockwell Feb 07 '22 at 20:54
  • I think you're really looking for a network synchronization product. WinSCP is not the one you want. – harrymc Feb 07 '22 at 21:04
0

There's a PowerShell script that uses WinSCP .NET assembly that does almost what you need:
https://winscp.net/eng/docs/library_example_moves_files_keeping_directory_structure#upload_powershell

Copy the script into local .ps1. Adapt it to your needs.

  • From your original post on Stack Overflow, I can see that you have followed these instructions already: https://winscp.net/forum/viewtopic.php?t=27829#92162
  • Additionally, I assume you do not want to delete the source files. So you will want to remove the $True argument from:
    $session.PutFiles($localFilePath, $remoteFilePath, $True)
    

Then you can install the script as an extension into WinSCP GUI. Go to Options > Preferences > Commands > Add > Add Extension.