I want to download all files 1 day old, regardless if they are in a directory, subdirectory, or on the root directory. Typically there is a list of directories with old files and a new file will be placed in the old directory every now and then.
The code below pulls the entire directory when it has at least one, 1-day old file has been placed in it. I'd like to only pull the 1-day old files from the directories and not the entire directory when a new file is placed in it.
Is this possible with a filemask? If so, what would I need to change below in the sample PowerShell code? (The log and destination variables are built prior to this script.)
& "C:\Program Files (x86)\WinSCP\WinSCP.com" `
/log="$log" /ini=nul `
/command `
"open ftpsite / -hostkey=`"`"hostKeyInfo`"`" -rawsettings FSProtocol=2" `
"cd /" `
"lcd $path" `
"get -FileMask *>=1D" `
"exit"
Thank you for your help.
You are missing a =
after the -filemask
.
You might want to add -rawtransfersettings ExcludeEmptyDirectories=on
to skip the folders that do not contain any eligible files.
Complete command should be like this:
get -filemask=*>=1D -rawtransfersettings ExcludeEmptyDirectories=on *