# Topic "Get remote path and file into local relative path"

Author Message
gcb-toronto
[View user's profile]

Joined: 2015-04-02
Posts: 3
Hi all,

If my script is running from

C:\temp

I want to get remote file

/root/test.txt

into

C:\temp\root\text.txt

without also getting empty directories from under the remote directory.

How to do this? I have experimented with both get and synchronize and filemasks. I have gotten close, but not exactly what I want.

I was able able to do this under Linux using rsync and I am trying to do the equivalent under Windows.

gb
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25931
Location: Prague, Czechia
Use get /* and exclude everything you do not want to transfer using -filemask=.
_________________
Martin Prikryl
gcb-toronto
[View user's profile]

Joined: 2015-04-02
Posts: 3
martin wrote:
Use get /* and exclude everything you do not want to transfer using -filemask=.

I am transferring a fixed set of files that are in various locations on the disk of a Linux computer. There are possibly hundreds of files that would need to be excluded. The point is to be able to specifically name the files that I want from the remote device. I don't think that excluding the files I do not want would be practical. Does WinSCP offer any better solutions?
gcb-toronto
[View user's profile]

Joined: 2015-04-02
Posts: 3
martin wrote:
Use get /* and exclude everything you do not want to transfer using -filemask=.

prikryl, thanks for pointing me in the right direction.

This is what I came up with:

winscp.exe /console /command "option confirm off" "open sftp://root:password@192.168.0.145" "get /root/MYFOLDER/test.txt" "close" "exit"

xcopy "test.txt" ".\root\MYFOLDER\" /Y
Advertisements

You can post new topics in this forum

## What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!