Topic "How to prevent traversing subfolders"

Author Message
falcon00
[View user's profile]

Joined: 2014-06-03
Posts: 2
I have a process where I download every existing file in a directory. Say I have:

/readme.txt
/Pub

I only want readme.txt but with ListDirectory I get everything in Pub as well. Is there a way to prevent this drill down behavior?
falcon00
[View user's profile]

Joined: 2014-06-03
Posts: 2
foreach (RemoteFileInfo fileInfo in directory.Files)
{
if (!fileInfo.IsDirectory)
{
session.GetFiles(remoteFTPDirectory + fileInfo.Name, localPath + fileInfo.Name, false, transferOptions).Check();
}
}

Unless somebody has a better idea.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
I suppose you've meant "but with GetFiles" (not ListDirectory).

Anyway, see FAQ:
http://winscp.net/eng/docs/faq_script_non_recursive
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License