As you can see from the title, I'm suffering the problem. didn't provide much information about this, I have to ask for solution somewhere else.
I already know how to up/down-load files and create directories, but the official reference doesn't say how to undo it.
I hope some one can tell me how to achieve this goal, or how to mount a ftp server as a local disk.

Recommended Answers

All 13 Replies

I'd very much like use native MacOSX API, rather than something "foreign".

Looks like you are going to have to subclass the CFNetworking classes. Try reading about the Undo Architecture first.

I assume you have already read this:

Another idea is to just move the files to a Trash dir until the client logs off then permanently erase the files.

Another option is to use a script to SSH to the remote machine then use your standard terminal commands "mount /dev/<whatever disk you want> /Volumes/<your newly created dir name for the remote disk>"to mount the volume to /Volumes/<your newly created dir name for the remote disk>

For the tunnel:
SSH user@host -p<servers port default is 22 you might want to setup a port forward on your router>

for more information on SSH on OSX type man ssh in terminal.

No. I just want something like the remove(char*) in stdio.h.
I can't make any more clear.

Then as I stated your going to need to write that function / class yourself.

Your asking for solutions which I have given you several on how to mount the remote disk locally but you rejected the ideas because they are not an easy cookie cutter solution wrapped in an apple framework. What you are asking for is not something as simple as remove(char *).

Have you read/downloaded the simple ftp example code?

I just want a solution in pure C/Obj-C solution, without shell scripts or any other language.
I'd also like the solution to be platform-insenstive, without the conversion like AppKit to UIKit.
And by undo I actually meant to really remove it even the file was already there without uploading.

Thank you anyway, though the example's in iOS, I was able to download its SDK.

I've done a research my self finding that there really isn't such API can do this.
I think the MacOSX itself and many other BSDs' not designed for such a purpose which is:
to operate a FTP server from remote. Rather, they're designed to be a server to delete them by itself.
I think this could be the best answer to why there isn't how
to delete ftp file/directory using MacOSX API.

Besides, SSH doesn't work on windows-based servers that have no ssh installed.

you are joking right? of course it doesn't. It's open source and has been installed on every server i have ever worked with. So install it. Wow, that post is unreal.

if you want to jeopardize a security sluth like me sniffing your data packets go right ahead and use something less secure.

Okay I found it. Use system() to run the ftp command in the /usr/bin.
Example: system("ftp");
Just like its done in terminal.

And there's mount_ftp command

This is no different then using a shell script to run SSH and SFTP. Using FTP is just a lot less secure. Do yourself a major favor and run it on a non-standard port number and or use port forwarding through your router. That will offer you some protection using standard FTP. But seriously consider switching to SSH now that you are essentially doing what I suggested in the first place.

Good luck.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.