LinuxQuestions.org
Help answer threads with 0 replies.
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
 
LinkBack Search this Thread
Old 09-10-2007, 12:26 PM   #1
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 450

Rep: Reputation: 68
Question Upload files to FTP with "curl"


Hi There,

I want to upload several files on a ftp site, but some of these files already exist on this FTP so I would like to prevent them to be re-uploaded again.

At the moment I'm using curl to do the job, but I overwrite all the files each times, as I couldn't find a way to make curl to check if the file exist, and if so, to skip it.

Current used code:
Code:
curl -T - --disable-epsv -u username:password ftp://Myftpsite:21
Is there any function in curl like "If-Exist-Do-Not-Overwrite"?

Or a way to implement that? (even with an other command I don't mind)

Best regards,
Angel

Last edited by angel115; 09-10-2007 at 12:28 PM.
 
Old 09-12-2007, 12:15 AM   #2
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: LFS-Version SVN-20091202, Arch 2009.08
Posts: 1,450

Rep: Reputation: 63
Maybe a script that pulls the current directory structure that is on the FTP server then checks it with the current list of files to be uploaded and does diffrent operations depending.

Sorry there is no code example but im not too familiar with writing scripts or using curl
 
Old 09-12-2007, 02:21 AM   #3
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 450

Original Poster
Rep: Reputation: 68
Yes I was thinking of that, I was just want to make sure that the command didn't have this build in functionality.

So yes, I'll do that thanks for your help.

Angel.
 
Old 09-12-2007, 07:48 AM   #4
Guttorm
Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 959

Rep: Reputation: 157Reputation: 157
Hi

Maybe you want to look "lftp"? It's a neat command line based FTP client that has a very useful command called "mirror" that does this kind of jobs. Debian has lftp so you can just apt-get install it.
 
Old 09-13-2007, 03:05 AM   #5
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 450

Original Poster
Rep: Reputation: 68
Hi Guttorm,

That's wonderful, thanks a lot, I didn't know this command before.

I didn't have the time to try yet, but i believe it will do the job.

Thanks again.

Angel.
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Curl - undefined reference "DES_set_odd_parity" - SOLVED sundialsvcs Linux - Software 0 09-15-2005 09:58 AM
WHAT'S does this "curl: (7) socket error: 111" mean??? njugs79 Linux - Newbie 2 04-05-2005 04:41 AM
C -communicating with system("ftp"); using "program|ftp>>myfifo" probably hansschmucker Programming 1 03-23-2005 01:39 PM
curl "incompatible pointer type" while making PHP basse- Linux - Software 2 04-15-2004 10:21 AM
"X-MS" cant open because "x-Multimedia System" cant access files at "smb&qu ponchy5 Linux - Networking 0 03-29-2004 11:18 PM


All times are GMT -5. The time now is 05:41 AM.

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
Open Source Consulting | Domain Registration