ListDirectory only returns directories and not files

Advertisement

menzo
Guest

ListDirectory only returns directories and not files

If I use WinSCP GUI client, I am connected to the default directory of the SFTP server and I can see the single file it contains.

However, if I use C# and connect to the same exact server then use ListDirectory(".") I only receive the ".." and the current directory name. No matter what I try it seems I am not able to view the file.

What is the trick I am missing?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,276
Location:
Prague, Czechia

Re: ListDirectory only returns directories and not files

That's probably some peculiarity of your FTP server.
Try doing session.ListDirectory(session.HomePath)

Reply with quote

Guest

Re: ListDirectory only returns directories and not files

The customer is using VShell from Vandyke using SFTP-3/SSH-2

File transfer protocol = SFTP-3
Cryptographic protocol = SSH-2
SSH implementation = SftpSSHD_1.4.31_Comments
Encryption algorithm = aes
Compression = No

Reply with quote

Guest

Re: ListDirectory only returns directories and not files

I did try and after some digging I see why WinSCP client works one way any my program works differently.

In the WinSCP tool I specify the directory to be /HOME_SFTP_DIR/LOC_OF_FILE

When I use C# I login and I am taken to /HOME_SFTP_DIR and of course the listing is only the directory.
However, I cannot figure out the command to change directory to /LOC_OF_FILE so then I can do a listing to see if there is anything for me to download.
So, I solved my first problem which was me, but I cannot figure out how to change directories.

Reply with quote

Advertisement

User1
Guest

Not able to list .jpg file through winscp

Hi,

I am not able to see the files under a directory from winscp but i am able to see them at OS level.They are not hidden files. Can you please help me.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,276
Location:
Prague, Czechia

Re: Not able to list .jpg file through winscp

User1 wrote:

I am not able to see the files under a directory from winscp but i am able to see them at OS level.They are not hidden files. Can you please help me.
This does not seem to be a WinSCP .NET assembly question. Please start new topic in an appropriate forum and make sure you include a session log file and more details.

Reply with quote

Advertisement

You can post new topics in this forum