Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

a1

Re: Remove leading path from source files (getfiles, multi-file)

Thank you very much. It works perfectly.
martin

Re: Remove leading path from source files (getfiles, multi-file)

Using /In tells WinSCP to download the folder, not its contents only. Use /In/*.

Also using D:\temp seems wrong and it should not do what you describe. You should use D:\temp\.
a1

Remove leading path from source files (getfiles, multi-file)

This Powershell code is used to download all files from the remove server's "/In" directory.
# Powershell

Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll"
$remotePath = "/In";
$localPath = "D:\temp"; 
$removeRemote = $TRUE;
[..]
$transferResult = $session.getfiles($remotePath, $localPath, $removeRemote);

It saves files in "D:\temp\In", but I want the files to be saved in "D:\temp". How do I remove the leading "In" part of the source file names?

WinSCP 5.5.6 (build 4746).