Filter files by date/time

Got a good idea? Want to share it? Then please take a moment to submit it.
Post Reply
mb
Posts: 12029
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Filter files by date/time

Post by mb » Fri Sep 18, 2009 1:10 pm

Add more sophisticated filter expression to transfer filter.

VARIABLE = [File.Name, File.Path, File.ModifiedTime, File.Size, File.Type]
OPERATOR = [ logical [>, <, >=, <=, ==, !=, ||, &&], arithmetic [+, -, *, /] ]
FUNCTION = [WildChar(pattern, string), RegExp(pattern, string), Date.Parse(string), Date.ParseSpan(string). Date.Now()]
CONST = [sfFileTypeFolder, sfFileTypeFile, sfFileTypeUnknown, MEGABYTE, KILOBYTE]

EBNF

Sample Expressions:
File.ModifiedTime >= Date.Now() - Date.ParseSpan("01:00")
File.ModifiedTime > Date.Parse("2009-12-31")
WildChar("*.txt", File.Name)
RegExp("^.*\\.txt$", File.Name)
File.Size > 100000
File.Type == sfFileTypeFolder

Function Date and DateSpan:
ISO 8601
Last edited by mb on Tue Sep 22, 2009 11:27 am, edited 1 time in total.

robgrealy
Posts: 1
Joined: Thu Sep 24, 2009 4:28 pm

Re: Filter files by date/time

Post by robgrealy » Thu Sep 24, 2009 4:40 pm

This would be extremely handy as I have SmartFTP pulling files to a directory on a server for a "not too bright user" (NTBU) to grab the latest files with various names from the previous day and then import them into an accounting program.

I ONLY need the "end of day".csv file to be pulled from the FTP site (the peeps at the FTP site NEVER delete any files).

So what happens at the moment is the NTBU has to "find" the newest files amongst all the files that get pulled down from the FTP site (which is ALL the files with wildcard.csv names) instead of ONLY the files that are younger then 24 hours.

When NTBU has exported the file to the accounting program, they then move it to a "Completed" folder, thus leaving the FTP receive folder empty.

At the moment, EVERY *.csv is coming down, EVERY day, and the NTBU is whining about it (yes, I've told them how to sort by date and only pull "yesterdays" folder over), but they still complain.

I don't want to have to start scripting a "DEL *.csv > 24 hours" or a "diff <ftp receive> <completed>" type scripts, as the user wants to be able to move the *.csv files when they have finished importing them.

HELP please guys ... really need a Filter by time added ...

Thanks,

Rob

Post Reply