Re: Help. In ftp sessions, how to refresh directory list?



This was for the PUT process. The coder of the example inline comment probably means that if you are doing any directory listing, it needs be refresh (listed again) in order to see the posted file. It is probably just a comment because this example was pulled from a more extensive example.

For example, if you wrote a FTP GUI program and you started it, connected to a ftp site, it will most likely start by listing the current directory. So you begin a PUT process, and having his note on the on the successful return TRUE, probably triggers a GUI refresh of the directory so you can see the newly posted file.

Same would true for any change in the directory (delete or rename). If successful, you should update the current directory listing. If FALSE, there is no need to refresh it because nothing changed.

The whole idea is akin to the typical console method:

ftp> DIR <---- list the directory
ftp> PUT afile <--- put a file
ftp> DIR <----- relist it to see the new file

For the WININET.DLL library, the FTP user command "DIR" translates to a FTP SERVER "LIST" command, and to WININET.DLL does an emulation of the FindFirstFile()/FindNextFile()/FindClose() APIs.

It is a SNAP SHOP, meaning, it does the ftp LIST in the background and then parses each ftp server response line which can be in various formats, to produce an internal list of WIN32_FIND_DATA records.

It begins this process with FtpFindFirstFile() and the successful return results with the first record from the WIN32_FIND_DATA internal list, and when you call InternetFindNextFile(), it gets the next record in the list, and so on. In the end, you InternetCloseHandle() to clean up the process.

--
HLS

Larry wrote:
I read a document about FTP Sessions in MSDN.


http://msdn2.microsoft.com/en-us/library/aa384180.aspx


In the document, if you upload a file to FTP server, delete or rename
a file on FTP server, you need to remember to refresh directory
listing.


In the sample source code there is just a comment: // Remember to
refresh directory listing. But how to do it in C++? Just send a LIST
ftp command or use FtpFileFinder to enumerate the files on FTP
server?

Laurence

.



Relevant Pages

  • Re: long ftp dir listings
    ... > I am often annoyed trying to get a long directory listing from my unix box ... I often resort to using ftp in Windows DOS mode so I can scroll ... I use zsh's built in ftp. ... autoload -U zfinit ...
    (freebsd-questions)
  • RE: vsftpd Questions.
    ... FTP access, I want her not to sshinto my system using that user ... After this " Here comes the directory listing" message the directory listing ... directory instead of the respective user's home directory. ... -- redhat-list mailing list unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe ...
    (RedHat)
  • Re: FTP limitation on directory size
    ... I seem to remember someone talking in the past about some limitation on the ... directory size for FTP to be able to see all the files. ... The FTP server producing a directory listing can pretty well just use ... A gui client, on the other hand... ...
    (comp.os.vms)
  • Re: FTP
    ... Comment out the entry in /etc/inetd.conf and run "refresh -s inetd". ... Subject: FTP ... I would like to disable FTP on a server so that none of the other servers ...
    (AIX-L)
  • Re: Deny directory listing on vsftpd anonymous upload
    ... Create a file in your user_config_dir called ftp (ftp is the anonymous user) with the line: ... That should give a "550 Permission denied" message if the anonymous user attempts a directory listing. ... University of Leicester, Leicester, LE1 7RH, UK ...
    (RedHat)