Directory assistance
Looking for some help determining where I am making a mistake. I have a script that will remove files older than 14 days then get files from the previous day (24 hrs). The issue I am having is that its also bringing over every directory empty as well.
For instance I have directory 01234 with 3 files (1.wav, 2.wav and 3.wav) in it. The creation date (or modified date) is from 3 days back, so I really want to ignore it. I also have directory 56789 with 1 file in it (4.wav) and a creation date (modified date) within the last 24 hours.
Currently the directories 01234 and 56789 are being brought over (with a current timestamp btw) then are being loaded only if it is within the last day. In this case 56789 gets the 4.wav (with the timestamp preserved on the .wav file).
How can I get it to 1) ignore directory 01234 and 2) preserve the timestamp on directory 56789 not just the files in 56789? Any thoughts?
(Side note: I have a batch file passing in the directory at %1% with the /parameter command)
Batch file:
@echo off
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set dt=%%a
set year=%dt:~0,4%
set month=%dt:~4,2%
if %month%==01 set month=Jan
if %month%==02 set month=Feb
if %month%==03 set month=Mar
if %month%==04 set month=Apr
if %month%==05 set month=May
if %month%==06 set month=Jun
if %month%==07 set month=Jul
if %month%==08 set month=Aug
if %month%==09 set month=Sep
if %month%==10 set month=Oct
if %month%==11 set month=Nov
if %month%==12 set month=Dec
set filePath=\\fileserver\Dir1\%year%\%month%\
"C:\Program Files (x86)\WinSCP\WinSCP.exe" /console /script=FTPScript.txt /parameter %filePath% /log=FTPlog.txt
exit
Script:
option confirm off
option batch on
open sftp://UID:PWORD@SomeHost.com/ -hostkey="Some Host Key"
rm *<14D
get -preservetime -filemask="*>=1D" / %1%
exit
For instance I have directory 01234 with 3 files (1.wav, 2.wav and 3.wav) in it. The creation date (or modified date) is from 3 days back, so I really want to ignore it. I also have directory 56789 with 1 file in it (4.wav) and a creation date (modified date) within the last 24 hours.
Currently the directories 01234 and 56789 are being brought over (with a current timestamp btw) then are being loaded only if it is within the last day. In this case 56789 gets the 4.wav (with the timestamp preserved on the .wav file).
How can I get it to 1) ignore directory 01234 and 2) preserve the timestamp on directory 56789 not just the files in 56789? Any thoughts?
(Side note: I have a batch file passing in the directory at %1% with the /parameter command)
Batch file:
@echo off
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set dt=%%a
set year=%dt:~0,4%
set month=%dt:~4,2%
if %month%==01 set month=Jan
if %month%==02 set month=Feb
if %month%==03 set month=Mar
if %month%==04 set month=Apr
if %month%==05 set month=May
if %month%==06 set month=Jun
if %month%==07 set month=Jul
if %month%==08 set month=Aug
if %month%==09 set month=Sep
if %month%==10 set month=Oct
if %month%==11 set month=Nov
if %month%==12 set month=Dec
set filePath=\\fileserver\Dir1\%year%\%month%\
"C:\Program Files (x86)\WinSCP\WinSCP.exe" /console /script=FTPScript.txt /parameter %filePath% /log=FTPlog.txt
exit
Script:
option confirm off
option batch on
open sftp://UID:PWORD@SomeHost.com/ -hostkey="Some Host Key"
rm *<14D
get -preservetime -filemask="*>=1D" / %1%
exit