LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-01-2010, 09:05 AM   #1
eiland
LQ Newbie
 
Registered: Apr 2007
Posts: 3

Rep: Reputation: 0
cURL recursive FTP upload


Hi,

I work on two hosts, [1] with online ftp access, and [2] without ncftp installed, but with ssh access.

Now I need to recursively upload a folder from [2] to [1]. So I can't use hardfeed - which is for downloading

I think I can use a

find ./orig -exec curl ftp://pinshosting.net

But I'm not so so known with the params of find and curl to get it working recursively. Any hints?
 
Old 04-01-2010, 09:14 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by eiland View Post
Hi,

I work on two hosts, [1] with online ftp access, and [2] without ncftp installed, but with ssh access.

Now I need to recursively upload a folder from [2] to [1]. So I can't use hardfeed - which is for downloading

I think I can use a

find ./orig -exec curl ftp://pinshosting.net

But I'm not so so known with the params of find and curl to get it working recursively. Any hints?
Have you considered using 'cURL' in conjunction with 'find' - in the latter consider '-exec' command line switch.
 
Old 04-01-2010, 10:07 AM   #3
eiland
LQ Newbie
 
Registered: Apr 2007
Posts: 3

Original Poster
Rep: Reputation: 0
YES! That was exactly my question; how to do that....
 
Old 04-01-2010, 10:08 AM   #4
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by eiland View Post
YES! That was exactly my question; how to do that....
What is the question ? The combination of find + cURL allows cURL to be called for each file separately.

Have you read 'find' manpage ?
 
Old 04-01-2010, 02:42 PM   #5
eiland
LQ Newbie
 
Registered: Apr 2007
Posts: 3

Original Poster
Rep: Reputation: 0
so i made a bash script:

Code:
#!/bin/bash
ftp_site=ftp.yoursite.net
username=my_user_name
passwd=my_password
remote=/path/to/remote/folder
folder=$1
cd /path/to/local/folder/$folder
pwd
ftp -in <<EOF
open $ftp_site
user $username $passwd
mkdir $remote/$folder
cd $remote/$folder
mput *
close
bye
and called it with

Code:
find . -type d -exec ./recursive-ftp.sh {} \;
seems to work.
 
  


Reply

Tags
curl, ftp, recursive


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
trying to remote upload to sharecash.org with curl steve51184 Linux - Software 6 10-01-2009 08:50 PM
having a little trouble with curl and ftp steve51184 Linux - Software 8 08-19-2009 05:19 PM
Is there an ftp program that allows for multi-thread ftp uploads ? Want faster upload brjoon1021 Linux - Software 4 02-04-2009 06:28 PM
Upload files to FTP with "curl" angel115 Programming 4 09-13-2007 03:05 AM
Recursive Upload Script Kenji Miyamoto Linux - General 1 09-01-2005 11:18 PM


All times are GMT -5. The time now is 07:06 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration