@@ -17,7 +17,7 @@ internal class ScpAccessProvider : IAccessProvider
1717 SftpClient ftpClient ;
1818 private readonly RemoteState remoteState ;
1919 public string AccessPath { get ; private set ; }
20-
20+
2121 private readonly ILogger logger ;
2222 public ScpAccessProvider ( NetworkCredential credentials , ILogger logger , string stateFilename )
2323 {
@@ -137,7 +137,7 @@ public bool MatchesPattern(string fileName, string pattern)
137137 return Regex . IsMatch ( fileName , regexPattern , RegexOptions . IgnoreCase ) ;
138138 }
139139
140- public List < FileInfo2 > GetFiles ( DateTime minimumLastWriteTime , string pattern , string path = null , bool recursive = false , List < string > subfolders = null )
140+ public List < FileInfo2 > GetFiles ( DateTime minimumLastWriteTime , string pattern , string path = null , bool recursive = false , List < string > subfolders = null , bool olderFiles = false )
141141 {
142142 //add try catch for non existent folders
143143 EnsureConnected ( ) ;
@@ -156,7 +156,7 @@ public List<FileInfo2> GetFiles(DateTime minimumLastWriteTime, string pattern, s
156156 try
157157 {
158158 var files = ftpClient . ListDirectory ( basePath ) ;
159- var sepChar = "/" ;
159+ var sepChar = "/" ;
160160 if ( recursive )
161161 {
162162 foreach ( var folder in files . Where ( x => x . IsDirectory && ! ( x . Name == "." ) && ! ( x . Name == ".." ) ) )
@@ -165,8 +165,8 @@ public List<FileInfo2> GetFiles(DateTime minimumLastWriteTime, string pattern, s
165165 ret_val . AddRange ( GetFiles ( minimumLastWriteTime , pattern , subPath , recursive ) ) ;
166166 }
167167 }
168- ret_val . AddRange ( files . Where ( x => MatchesPattern ( x . Name , pattern ) ) . Where ( x => x . LastWriteTime >= minimumLastWriteTime && ! x . IsDirectory ) . Select ( x =>
169- new FileInfo2 ( $ "{ ( AccessPath . Length + 1 < basePath . Length ? ( basePath . Substring ( AccessPath . Length + 1 ) ) + sepChar : string . Empty ) } { x . Name } ", exists : true ) { LastWriteTime = x . LastWriteTime , Length = x . Length } ) . ToList ( ) ) ;
168+ ret_val . AddRange ( files . Where ( x => MatchesPattern ( x . Name , pattern ) ) . Where ( x => ( olderFiles ? x . LastWriteTime <= minimumLastWriteTime : x . LastWriteTime >= minimumLastWriteTime ) && ! x . IsDirectory ) . Select ( x =>
169+ new FileInfo2 ( $ "{ ( AccessPath . Length + 1 < basePath . Length ? ( basePath . Substring ( AccessPath . Length + 1 ) ) + sepChar : string . Empty ) } { x . Name } ", exists : true ) { LastWriteTime = x . LastWriteTime , Length = x . Length } ) . ToList ( ) ) ;
170170 }
171171 catch ( Exception exc )
172172 {
0 commit comments