Topic "excluding subdirectories using "get" in batch file"

Author Message
jawa230

Guest


I am writing a bath file to download files from a remote server.
What I need the file in the current folder, not the subdirectories.
this is my command in batch file:
"get -filemask=*.xml|*/ /user/config/folder C:\Users\Desktop\Batch"

but there is no files downloaded. If I only use "-filemask=*.xml", all xml files both in current folder and subdirectories are downloaded.

what is wrong with my code? thanks a lot.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25025
Location: Prague, Czechia
"get -filemask=*.xml|*/ /user/config/folder/* C:\Users\Desktop\Batch\"

See https://winscp.net/eng/docs/scriptcommand_get#remarks
jawa230

Guest


martin wrote:
"get -filemask=*.xml|*/ /user/config/folder/* C:\Users\Desktop\Batch\"

See https://winscp.net/eng/docs/scriptcommand_get#remarks


This does not work Sad No files are dowloaded at all.
If I use "-filemask=*.xml", all xml files in current folder and its subdirectories are download. But adding |*/ excludes everything. Should I add path to "*.xml" in the file mask?
jawa230

Guest


jawa230 wrote:
martin wrote:
"get -filemask=*.xml|*/ /user/config/folder/* C:\Users\Desktop\Batch\"

See https://winscp.net/eng/docs/scriptcommand_get#remarks


This does not work Sad No files are dowloaded at all.
If I use "-filemask=*.xml", all xml files in current folder and its subdirectories are download. But adding |*/ excludes everything. Should I add path to "*.xml" in the file mask?


I think I found the cause. I did not create the folder Batch on the Desktop, so there is an error message "can not create *.xml file". After I created an empty folder "Batch", the xml files are now downloaded to that folder correctly. This is interesting, because if I use "*.xml", the script automatically creates a folder for me. But with |*/, I need to manually create a folder beforehand.
Advertisements

You can post new topics in this forum






Search Site

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License