Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: grabbing the subdirectories that are 5 minutes old

So what does it do when "it doesn't work"? Consider posting a session log file, if appropriate, to document the problem.
anjali

Re: grabbing the subdirectories that are 5 minutes old

Yes, I can. How do I filter out the files that are 5 minutes old. I tried to use this mask, but it doesnt work:
transferOptions.FileMask = "*<=10N";

Below is my full code in C#:
string localPath = ConfigurationManager.AppSettings["localPath"];
string remotePath = ConfigurationManager.AppSettings["remotePath"];
using (Session session = new Session())
{
    // Connect
    session.Open(sessionOptions);
 
    // Download files
    TransferOptions transferOptions = new TransferOptions();
    transferOptions.TransferMode = TransferMode.Binary;
    transferOptions.FileMask = "*<=10N";
    TransferOperationResult transferResult;
    transferResult =
        session.PutFiles(@"K:\*", "/D:/eFiles/"true, transferOptions);
 
    // Throw on any error
    transferResult.Check();
 
    // Print results
    foreach (TransferEventArgs transfer in transferResult.Transfers)
    {
        Console.WriteLine("Download of {0} succeeded", transfer.FileName);
    }
}


any help will be highly appreciated.
martin

Re: grabbing the subdirectories that are 5 minutes old

WinSCP cannot select folders based on a time, only files. Can you use the timestamps of contained files for the selection?
anjali

grabbing the subdirectories that are 5 minutes old

Hello All,

I want to SFTP files and sub folders from my local path to remote path. My code is working fine if I want to transfer all the files and sub directories, but I only want to grab those sub directories that are 5 minutes old. In other words, I dont want to grab any sub directory that is very new. How can I achieve this. Below is my code:

TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;
 
TransferOperationResult transferResult;
transferResult =
    session.PutFiles(@"K:\Documents\*", "/D:/Files/"true, transferOptions);
 
// Throw on any error
transferResult.Check();


Any Help will be greatly appreciated.