I'm using this in C# to pull down files from a remote ftp on a daily basis.
My question is this, when enumerating the remote folder, subfolders and files, i'm having an issue where the results don't always include the folder names. (I.e. having iSDirectory set)
For example, when the
lastModifiedEndDate = DateTime.Now.AddDay(0)
However, using anything other than 0 (today), it will return files, but not directory names.
lastModifiedEndDate = DateTime.Now.AddDay(-1) (Today minus 1 day)
I suspect this is because, as new files get added to these directories everyday, the folder will always have a timestamp for the current day and that is why they do not get included in the result set when filtering on older date ranges.
I hope this makes sense. I need to pull back subfolder names every time regardless of date filtering.
I don't want to exclude the folder names from my results, just exclude them from the date filtering.
EnumerationOptions eOptions = EnumerationOptions.AllDirectories | EnumerationOptions.EnumerateDirectories;
fileInfos = session.EnumerateRemoteFiles(argsSettings.filePaths.remoteFolder, null, eOptions).Where(file => ((file.LastWriteTime.Date >= lastModifiedStartDate.Date) && (file.LastWriteTime.Date <= lastModifiedEndDate.Date)));