LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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-29-2004, 11:21 PM   #1
Xanith
LQ Newbie
 
Registered: Apr 2004
Posts: 1

Rep: Reputation: 0
Need help FTPing and Moving files.


I am not sure if there is a command or really easy way I can do this but I am looking to have the ability to FTP to a remote computer and transfer over *.whatever files then have those files either moved or deleted after the transfer is complete.

Is there an easy way to do this or a script/program I could use that I am missing?

Thanks for any help in advance!
 
Old 04-30-2004, 07:49 AM   #2
ac1980
Member
 
Registered: Aug 2003
Location: Trento, Italy
Distribution: Debian testing
Posts: 394

Rep: Reputation: 30
Well, it all depends on which language and which OS you use... basically you can exec ftp with stdin attached to a pipe, use that to send commands, and then when the ftp process ends perform the other actions.
If you prefer, perl, tcl and others have native ftp libraries, so you can avoid forking.
 
Old 04-30-2004, 10:51 AM   #3
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
check out the expect scripting language, it's designed for automating interactive tasks.
 
Old 04-30-2004, 05:32 PM   #4
Nnyan
LQ Newbie
 
Registered: Jun 2003
Posts: 6

Rep: Reputation: 0
I'm using LFTP (http://lftp.yar.ru/) with Linux and it works fine. Here is an example from the shell script this is from. I run this from crontab.

I have it deleting the uncompressed backupfile that i get when I backup my DB using mysqldump but you can have it delete anything you want.

The $mdate puts the current timestamp on my files (which it gets earlier in the script).

If you plan on using lftp make sure /usr/local/bin is in your path and its exported.

lftp <<EOF
open yourftpserverhere
user USERNAME PASSWORD
pwd
put dbname-$mydate.tar.gz
bye
EOF
rm /dir1/dir2/dir3/dir4/backup.sql

Last edited by Nnyan; 04-30-2004 at 05:38 PM.
 
Old 04-30-2004, 07:50 PM   #5
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
that's quite cool ftp client, nice!
 
Old 05-03-2004, 08:42 PM   #6
Nnyan
LQ Newbie
 
Registered: Jun 2003
Posts: 6

Rep: Reputation: 0
Yeah I really like it = )
 
Old 05-04-2004, 09:59 AM   #7
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
LOL i love it when u see some cool program, and then go type 'man that_cool_program' hoping it's already installed and it is
 
  


Reply



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
Moving files Pyrophorus Slackware 5 11-09-2005 10:47 AM
Moving files UmneyDurak Fedora 4 08-28-2005 05:52 PM
moving files pantera Programming 2 08-23-2005 05:58 AM
Moving Files arockia Linare 3 09-08-2004 08:14 AM
Moving Files jhotchkiss Linux - Newbie 5 09-16-2003 03:41 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:00 AM.

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