error using move file when folder is empty

Advertisement

andybruner
Joined:
Posts:
7

error using move file when folder is empty

I am using this C# code to move files:
session.MoveFile("/parcs/download/PNB/*.xml", "/parcs/download/PNB/Processed/");
It works fine unless the folder is empty then I get this error.
Message:/parcs/download/PNB/*.xml not found.;
Source:WinSCPnet;
Type:WinSCP.SessionRemoteException;
Base Exception:WinSCP.SessionRemoteException: /parcs/download/PNB/*.xml not found.
at WinSCP.Session.MoveFile(String sourcePath, String targetPath)
at RppGLUpdate.Class1.Main(String[] args).
How do I fix this so that it is okay with an empty folder?
THanks.

Reply with quote

Advertisement

andybruner
Joined:
Posts:
7

I see examples like this one where you get the count but when I type in .Count it is not accepted as good code. How do you make it so that .Count shows up as an option? (see attached image) This may sound like an elementary question but I am not a professional programmer. Just trying to piece things together. Thanks.
int directoriesCount = session.EnumerateRemoteFiles(
    sftpFolder, "*.xml", EnumerationOptions.None).Count;

code.jpg

Reply with quote

Advertisement

You can post new topics in this forum