Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

martin

Re: How to exclude directories during a get

The /transfer/ works, only if transfer is in the root folder. If not, use just transfer/ (or the actual absolute path to the folder). If you still have problems, please post a session log file.
eghali

Re: How to exclude directories during a get

Hello, I'm trying the following:
get ""/d/export"" -filemask=""/*/*/*/etlexpmx_BCF_*.xml.gz>2D;/*/*/*/etlexpmx_ETP_*.xml.gz>2D;|/transfer/;""

to exclude "transfer" folder but still it's including it in the download, what am I missing?
martin

Re: How to exclude directories during a get

KTGOPS1 wrote:

Was not working at first until I had to add the / after the l1.

That's correct. Note that my exclude path also ends with a slash.
KTGOPS1

Re: How to exclude directories during a get

Thank you very much. This worked. Below is what my new txt file looks like. Was not working at first until I had to add the / after the l1. L1 is the folder I was excluding. Works great now. Thanks again.

option echo off
option batch on
option confirm off
open sftp://user:password@10.10.10.10
lcd "D:\Backups\Software\12-07-2017"
cd /home/customer/data/2017/12/07
get *.* -filemask=|/home/customer/data/2017/12/07/l1/
exit
KTGOPS1

How to exclude directories during a get

I have automated a sftp file and directory download process through a batch file. There is one directory one the server I do not need to download but I can not figure out how to exclude that directory. I could download it and delete it but it is a huge folder that doesn't need to be pulled down. How can I exclude the folder. Here is my batch file now.

I am using winscp version 5.11.2
This is running on Windows Server 2012 R2

There is a folder in this directory on the server I should not download. /home/customer/data/%year%/%month%/%day%

@echo off

Set CurrentDate=%date:~4,2%-%date:~7,2%-%date:~10,4%
Set Year=%date:~10,4%
Set Month=%date:~4,2%
Set Day=%date:~7,2%

if not exist D:\backups\Software\%CurrentDate% md D:\backups\Software\%CurrentDate%

Echo option echo off>d:\test\downloadscript.txt
Echo option batch on>>d:\test\downloadscript.txt
Echo option confirm off>>d:\test\downloadscript.txt
Echo open sftp://user:password@10.10.10.10>>d:\test\downloadscript.txt
Echo lcd "D:\Backups\Software\%CurrentDate%">>d:\test\downloadscript.txt
Echo cd /home/customer/data/%year%/%month%/%day%>>d:\test\downloadscript.txt
Echo get *.*>>d:\test\downloadscript.txt
Echo exit>>d:\test\downloadscript.txt


"C:\Program Files (x86)\WinSCP\Winscp.com" /script=d:\test\downloadscript.txt

C:\Progra~1\7-Zip\7z a -r D:\backups\Software\%currentDate%.7z D:\backups\Software\%CurrentDate%\*

RD /S /Q D:\backups\Software\%currentDate%

del downloadscript.txt