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
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