LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-26-2018, 10:33 AM   #1
Entropy1024
Member
 
Registered: Dec 2012
Location: UK
Distribution: Ubuntu 16 & 17
Posts: 130

Rep: Reputation: Disabled
wget wit move


I need to download some files from an FTP site and currently using the following:

Code:
wget --user=$USER --password=$PASSWD -nc 'ftp://ftp.mysite.com/*'
This copies the files from the remote FTP site to the local machine. However I want to move the files, not copy them.
How can I move the files please?
 
Old 08-26-2018, 10:47 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,266

Rep: Reputation: 4200Reputation: 4200Reputation: 4200Reputation: 4200Reputation: 4200Reputation: 4200Reputation: 4200Reputation: 4200Reputation: 4200Reputation: 4200Reputation: 4200
I would say wget cannot do that. Furthermore it depends on the ftp server (and its configuration), so probably it is not possible at all.
But theoretically ftp may have a delete command, so you only need a short ftp script like this:
Code:
bin
get remote_file local_file
delete remote_file
https://unix.stackexchange.com/quest...lete-it-from-t
https://stackoverflow.com/questions/...multiple-files

Last edited by pan64; 08-26-2018 at 10:50 AM.
 
1 members found this post helpful.
Old 08-26-2018, 10:59 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 22,113

Rep: Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914Reputation: 5914
Quote:
Originally Posted by Entropy1024 View Post
I need to download some files from an FTP site and currently using the following:
Code:
wget --user=$USER --password=$PASSWD -nc 'ftp://ftp.mysite.com/*'
This copies the files from the remote FTP site to the local machine. However I want to move the files, not copy them. How can I move the files please?
You don't with wget or FTP; neither will do what you want in one step. The usual 'you should *NOT* be using FTP for anything' advice applies here too. FTP is badly insecure, and using either SCP/SFTP or rsync over SSH is far better. Using SSH is far simpler, since (by means of a keyswap), you can have the copy take place, then remove the files with only two lines in a script.

Rsync over SSH is the best option, since it *CAN* remove the files:
Code:
rsync -avz --remove-source-files -e ssh /some/local/path user@remotehost:/some/remote/path
 
3 members found this post helpful.
  


Reply

Tags
wget


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
Help wit awk mierdatuti Programming 20 08-06-2015 11:26 AM
LXer: Using Wget With FTP To Download/Move Web Sites Recursively LXer Syndicated Linux News 0 10-26-2012 03:41 PM
How to resume an interrupted wget using wget.log? misterJ Linux - Software 2 06-19-2011 02:21 PM
How to use wget to move content from one directory to another Spawn10 Linux - Newbie 2 09-21-2010 04:38 PM
Problem Wit Firefoxt iBOT Linux - Newbie 4 02-18-2008 10:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration