Error Downloading File - Wildcard Issue?

Advertisement

JasonRkr
Joined:
Posts:
13
Location:
Sunny Southern California

Error Downloading File - Wildcard Issue?

Group,

I'm receiving a file not found error when trying to download a file using a wildcard in the name. However, when I use the full file name it works without issue. Below is a section of the DebugLog file in the hopes it may provide additional detail. Also, the server I'm downloading from is running AIX 6.

<session xmlns="https://winscp.net/schema/session/1.0" name="qcupload@vm6klab1" start="2013-08-14T21:07:07.742Z">
<group name="open -hostkey=&quot;ssh-rsa 2048 0e:2b:76:24:bf:50:e7:29:f5:01:2b:e6:59:16:ea:10&quot; -timeout=15 sftp://qcupload:***@vm6klab1" start="2013-08-14T21:07:08.539Z">
</group>
<group name="stat -- &quot;/U/softprint/FTP14*.x&quot;" start="2013-08-14T21:07:08.664Z">
<stat>
<filename value="/U/softprint/FTP14*.x" />
<result success="false">
<message>Can't get attributes of file '/U/softprint/FTP14*.x'.</message>
<message>No such file or directory.
Error code: 2
Error message from server: No such file
Request code: 7</message>
</result>
</stat>
<failure>
<message>Can't get attributes of file '/U/softprint/FTP14*.x'.</message>
<message>No such file or directory.
Error code: 2
Error message from server: No such file
Request code: 7</message>
</failure>
</group>
<group name="exit" start="2013-08-14T21:07:08.789Z">
</group>
</session>

Thank you,

Jason

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: Error Downloading File - Wildcard Issue?

For download (Session.GetFiles, note the plural) you can indeed use wildcards. But from the log, I suppose you are using Session.FileExists (note the singular) first, that does not support wildcards:
https://winscp.net/eng/docs/library_session_fileexists
_________________
Martin Prikryl

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Ok, but I suppose you set the fileName to FTP14*.x.

As the example, you refer to, calls session.FileExists(remotePath) before calling session.GetFiles(remotePath, localPath), it fails. You probably do not want the check at all. Just remove it.

Also note that the example does not use wildcards, nor mentions anywhere that you can use wildcards for it.

Anyway this is really just an code sample. If you want its functionality, including wildcard support, use the simple code mentioned in comments:
// You can achieve the same using:
session.SynchronizeDirectories(
    SynchronizationMode.Local, localPath, remotePath, false, false, SynchronizationCriteria.Time, 
    new TransferOptions { IncludeMask = fileName }).Check();    

Reply with quote

Advertisement

You can post new topics in this forum