How to use any command in FTP ?

Posted by Scurz on Fri 25 Apr 2008 at 12:09

Tags: ,

I wanted to use the "find" command on a FTP space but it's not possible to use this command with any "normal" FTP client. So, I looked for a solution.

Therefore, I discovered curlftpfs. with this tool, it is possible to use any command (whose "find"). Great !

Even if the example on the curlftpfs's website is explicit, I'm going to give another fuller example.

# Adapt $USER, $PASSWD & $HOST ;
mkdir /root/tmpftp
curlftpfs ftp://$USER:$PASSWD@$HOST/ /mnt/directory/
And what I wanted to do with "find" :
# Adapt $USER, $PASSWD & $HOST ;
mkdir /root/tmpftp
curlftpfs ftp://$USER:$PASSWD@$HOST/ /root/tmpftp/

# To remove all files which are older than 5 days.
cd /root/tmpftp
find ./ -mtime +5 -exec rm -f {} \;
Share/Save/Bookmark


Posted by Anonymous (199.72.xx.xx) on Fri 25 Apr 2008 at 14:38
Sounds like a job for ssh.

[ Parent | Reply to this comment ]

Posted by Anonymous (84.255.xx.xx) on Fri 25 Apr 2008 at 17:09
sometimes it's not an option :)

[ Parent | Reply to this comment ]

Posted by Scurz (213.41.xx.xx) on Sat 26 Apr 2008 at 09:11
[ Send Message ]
Yes, but we must have a SSH access and it's not always the case. :)

[ Parent | Reply to this comment ]

Posted by Anonymous (217.194.xx.xx) on Sat 26 Apr 2008 at 08:11
lftp has a find command.

[ Parent | Reply to this comment ]

Posted by Scurz (213.41.xx.xx) on Sat 26 Apr 2008 at 09:07
[ Send Message ]

Hmm, yes, in fact. But with curlftpfs, you can use any command (it's just an argument to use this tool). And it was just an exemple with the "find" command. ;-)

To complement my article (I've forgotten to write it) :

# Adapt $USER, $PASSWD & $HOST ;
mkdir /root/tmpftp
curlftpfs ftp://$USER:$PASSWD@$HOST/ /root/tmpftp/

cd /root/tmpftp
"use any command present with you system" 

Please take note, the second command ("curlftpfs ftp://$USER:$PASSWD@$HOST/ /root/tmpftp/") mounts the space FTP.

[ Parent | Reply to this comment ]

Posted by Anonymous (202.164.xx.xx) on Sat 26 Apr 2008 at 08:57
How does this compare to ftpfs?

[ Parent | Reply to this comment ]

Posted by Anonymous (87.177.xx.xx) on Sun 27 Apr 2008 at 18:05
This *is* ftpfs.

[ Parent | Reply to this comment ]

Posted by benjamin (193.95.xx.xx) on Fri 2 May 2008 at 02:30
[ Send Message | View Weblogs ]
nice

--
I'm not a comlpete idoit - some prats are missnig.

[ Parent | Reply to this comment ]

Posted by Anonymous (217.91.xx.xx) on Thu 3 Jul 2008 at 15:00
This bug with curlftpfs is still not fixed and makes it unrealiable, especially when used unattended within cronjobs. I worked around it by issuing a file $filename on every file in a ftpfs-folder before any real work on $filename takes place.
If you see random "access denied" or "file not found" messages this might be a solution.

[ Parent | Reply to this comment ]


User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search