EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TElSftpFileInfo.FullName

Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.
#21690
Posted: 09/24/2012 23:01:05
by Luke Ryan (Basic support level)
Joined: 09/24/2012
Posts: 4

Hi,
I'm looking at the result from retrieving a TElSftpFileInfo object. It appears that the FullName property is always empty and the Name property has the FileName value. I was expecting the FullName property to contain the full path to the filename, is this a bug? If not is there a way to find the whole path (directory and filename) from a TElSftpFileInfo result.
Thanks
#21691
Posted: 09/25/2012 00:21:25
by Eugene Mayevski (EldoS Corp.)

According to the standard, FullName is obsolete and should be neither returned nor used. In versions of SFTP before 3 it *usually* contained the string similar to what unix ls command produces for the entry, but this was not mandatory. Full path is never provided by SFTP (there's RequestAbsolutePath for a directory but it produces server-specific results).


Sincerely yours
Eugene Mayevski
#21693
Posted: 09/25/2012 01:26:01
by Luke Ryan (Basic support level)
Joined: 09/24/2012
Posts: 4

Thanks for your quick reply, RequestAbsolutePath seems to just return the same string passed to it in my case.
Would be good to have the TElSftpFileInfo result from ListDirectory to include the Full Remote Path somewhere (property or within the SftpFileAttributes).

var directoryResults = new ArrayList();
_sftpClient.ListDirectory(path, directoryResults);

At the moment i need to wrap the result to achieve this. In my case i wanted to selectively build up a list of files to transfer from multiple directories i.e. build a List<TElSftpFileInfo> and then make multiple calls to _sftpClient.DownloadFile() with the full file path

Your thoughts?
#21694
Posted: 09/25/2012 01:39:41
by Eugene Mayevski (EldoS Corp.)

I am not sure that I understand you right. Do you mean that ListDirectory needs to combine `path` parameter with resulting file name and store the combined string somewhere in TElSftpFileInfo?


Sincerely yours
Eugene Mayevski
#21695
Posted: 09/25/2012 01:55:10
by Luke Ryan (Basic support level)
Joined: 09/24/2012
Posts: 4

Yes exactly :)
#21696
Posted: 09/25/2012 01:59:34
by Eugene Mayevski (EldoS Corp.)

I don't think this is feasible, and here's why: for you and maybe some other developers this is a saver of one or two lines of code. For majority of users though this is an extra operation that occupies extra memory (for combined string) and takes extra time. If there were negative impact for users, we could implement such extension, but not in this case.

I have a good news for you though: you can replace the value of LongName property. So when you create List<TElSftpFileInfo> and populate it, you can combine the path with filenames and store the result to LongName property.


Sincerely yours
Eugene Mayevski
#21698
Posted: 09/25/2012 02:11:06
by Luke Ryan (Basic support level)
Joined: 09/24/2012
Posts: 4

Great, didn't realize that FullName property had a setter on it. That works for me, i can set it when i get the result back from ListDirectory.
Thanks for your help.
Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.

Reply

Statistics

Topic viewed 820 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!