Delete remote file

How do i delete a remote file?
I tried the HTTPSocket.SendRequest(“DELETE”, URL as string, Timeout as integer) but nothing happens.
Can someone advise or direct me in the right the direction?

Is the server that should do the relative action (remove resource, reduce a counter or whatever delete means for that server)
what’s the sever reply status?

I would expect you need to have authentication for this.

PS: You can use MBS CURL Plugin for this. Supports SFTP, FTPS and FTP, too.

I get a status code OK but nothing happens the file is still there.

here is my code and please be kind. I am new to this. :slight_smile:

Dim filename, path, deletefile as string
Dim urlSocket As New HTTPSocket
filename = listbox1.cell(0,0)
path = "" + combobox1.text + "/" + filename
deletefile = urlSocket.SendRequest("DELETE", path, 30)
MsgBox Str(urlSocket.HTTPStatusCode.ToText)

My understanding is an HTTP DELETE requests the server delete the supplied resource. Unless it’s your server and you’ve implemented this request to delete a file, I don’t suspect it’s going to do anything.

The “server” is just an sd card in a camera that I connect to via Wifi.
I am able to do Httpsocket.get and download the photo but now i want to be able to delete it.
Is that possible. Authentication is not necessary as it is done when the Wifi connection is established.

[quote=245401:@Kareem Danish]The “server” is just an sd card in a camera that I connect to via Wifi.
I am able to do Httpsocket.get and download the photo but now i want to be able to delete it.
Is that possible. Authentication is not necessary as it is done when the Wifi connection is established.[/quote]
Is there an API or documentation? What kind of card is it?

@Tim Parnell
It is a microSD card in a wifi enabled camera. Not aware of any API.

most SD cards in cameras mount the same as if they were a USB Flash drive, so no TCP/Socket is required… just normal “disk” operations

If it’s plugged in via cable, yeah - but the wifi cameras/cards could be different. It would depend on what the manufacture has to say in the manual for how to use the features.

I would love to Google it for you, but you didn’t tell me what kind of camera it is.

My question now is exactly how is the file being downloaded? Using FTP commands? that would require a minimal FTP server pkg to be on the camera … best I’ve seen is cameras that stream the pics (as they are taken) to a nearby laptop (or other computer) running special software supplied by the camera mfg. but I have not seen true “FTP”

As @Kareem said: [quote]I am able to do Httpsocket.get and download the photo[/quote]

It is a GoPro and uses a Cherokee Web Server. Does this help?

I’ve been looking at the cherokee documentation, are you able to ssh your way in?

@Tim Parnell I have never worked with secure shell but i am guessing yes. Is there any documentation you can point me to?

Most documentation for unix commands can be found within the terminal: man [command]
The trick is mostly trying to get in to the camera’s server, who knows if it requires auth, or where you’d find that password. I haven’t found much useful information on the gopro website. They have an app, but that’s about all they tell you.

Since you know the camera’s ip address you might as well try.

ssh [camera's ip]

If you can get in,

ls will show you all the files in the current directory.

cd [dir] will change the directory, and

rm [file]

Pretending that this ip address would take you to my home folder, here’s an example of how to navigate around and remove a file.

you$ ssh Password: [you@mycomp]$ ls Apps Desktop Documents Downloads Library Movies Music Pictures Public Sites [you@mycomp]$ cd Sites [you@mycomp Sites]$ ls htmledit nswrs timi webstudio [you@mycomp Sites]$ cd timi [you@mycomp timi]$ ls files images index.html xojo.html [you@mycomp timi]$ rm index.html
This is what your terminal window would look like after navigating to my Sites folder, and into the timi folder, then deleting index.html. The lines that start with “you” are lines in the terminal you would write, the others are output lines.

If you are able to ssh into the camera and navigate around, you can set up a rm command that can remove the image after you download it.

I tried to connect to the camera using ssh but that didn’t work.

You may want to try and connect with the Terminal first, to see what is exactly going on.

i did try using Terminal and it times out. I pinged the ip and it responded but when i try to ssh it gives me a time out response.

I suggest you contact the folks at GoPro and find out if they implemented the DELETE command at all. My guess is that they aren’t looking at the method at all and always treating it like GET or assuming that anything else is a HEAD request.

It’s worth pointing out that most well formed APIs will return a 2xx status code for a delete even if that only indicates the intent to perform the delete as they are often done asynchronously and it is the responsibility of the caller to verify that the item was indeed removed.