Skip to content

Latest commit

 

History

History
28 lines (24 loc) · 2.93 KB

steps-in-a-typical-ftp-client-application-to-delete-a-file.md

File metadata and controls

28 lines (24 loc) · 2.93 KB
description title ms.date helpviewer_keywords ms.assetid
Learn more about: Steps in a Typical FTP Client Application to Delete a File
Steps in a Typical FTP Client Application to Delete a File
11/04/2016
Internet client applications [MFC], FTP delete
WinInet classes [MFC], FTP
FTP (File Transfer Protocol) [MFC], client applications
Internet applications [MFC], FTP client applications
2c347a96-c0a4-4827-98fe-668406e552bc

Steps in a Typical FTP Client Application to Delete a File

The following table shows the steps you might perform in a typical FTP client application that deletes a file.

Your goal Actions you take Effects
Begin an FTP session. Create a CInternetSession object. Initializes WinInet and connects to server.
Connect to an FTP server. Use CInternetSession::GetFtpConnection. Returns a CFtpConnection object.
Check to make sure you're in the right directory on the FTP server. Use CFtpConnection::GetCurrentDirectory or CFtpConnection::GetCurrentDirectoryAsURL. Returns the name or URL of the directory you are currently connected to on the server, depending on the member function selected.
Change to a new FTP directory on the server. Use CFtpConnection::SetCurrentDirectory. Changes the directory you are currently connected to on the server.
Find the first file in the FTP directory. Use CFtpFileFind::FindFile. Finds the first file. Returns FALSE if no files are found.
Find the next file in the FTP directory. Use CFtpFileFind::FindNextFile. Finds the next file. Returns FALSE if the file is not found.
Delete the file found by FindFile or FindNextFile. Use CFtpConnection::Remove, using the file name returned by FindFile or FindNextFile. Deletes the file on the server for reading or writing.
Handle exceptions. Use the CInternetException class. Handles all common Internet exception types.
End the FTP session. Dispose of the CInternetSession object. Automatically cleans up open file handles and connections.

See also

Win32 Internet Extensions (WinInet)
Prerequisites for Internet Client Classes
Writing an Internet Client Application Using MFC WinInet Classes