0 votes
by (220 points)
edited

I am using Rebex 2005 to get and put files to a server. When I am done I need to Delete the files I deleted from the directory where the files resided "target_folder"

How can I delete the files? There is a DeleteFile(string remotePath) method in Rebex, but I don't know how to use it? What value needs to be specified for "remotePath"

Am I suppose to specify an actual physical hard drive for the file location? Like this: string fileName="Example.txt" client.DeleteFile("C:\remote_path" + fileName); // client is my Rebex object.

What confuses me is the rebex function prototype is as follows: void Ftp.DeleteFile(string remotePath)

it says remotePath, however it does not indicate that a filename needs to be specified?

Applies to: Rebex FTP/SSL

1 Answer

0 votes
by (147k points)
edited
 
Best answer

The remotePath argument of the DeleteFile method is a path to a file.

You are not supposed to specify an actual physical hard drive for the location - most FTP server present a virtual Unix-liek filesystem that uses slash ('/') as directory delimiter and the whole structure starts at "/". Check out the tutorial for more information.

To delete "Example.txt", use the same path you used to upload it using PutFile or download it using GetFile:

client.PutFile(@"c:\local_path\" + fileName, "/remote_path/" + fileName);
...
client.DeleteFile("/remote_path/" + fileName);
...