IT/Software/Command Line Applications/lftp: Difference between revisions

From msgwiki
Jump to navigation Jump to search
Access restrictions were established for this page. If you see this message, you have no access to this page.
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
lftp -c "open 192.168.1.41:2121/Music; lcd /local/directory; mirror -R -P 3 --ignore-time --delete"
<code>lftp -c "open 192.168.1.41:2121/Music; lcd /local/directory; mirror -R -P 3 --ignore-time --delete"</code>


-c run a command
-c run a command


mirror make two directories identical. typically remote to local
Separate all command with ;
 
mirror makes two directories identical. Default is remote to local


-R makes mirror local to remote
-R makes mirror local to remote
Line 15: Line 17:
--delete will remove files if no longer in the source.
--delete will remove files if no longer in the source.


lcd /local/directory;  this is a separate command that specifies the local directory so that you can more easily script lftp
lcd /local/directory;  this is a separate command that specifies the local directory so that you can more easily script lftp otherwise it uses the current working directory.
 
pwd will print the working directory on the remote machine
 
lpwd will print the local working directory. That is where you ran the script from NOT what may be specified in the script.
 
<code>lftp -c "set net:timeout 2 ; set net:max-retries 2 ; set net:reconnect-interval-base 5 ; open 192.168.1.41:2121/Music; lcd /local/directory;  mirror -R -P 3 --ignore-time --delete --verbose"</code>
 
The set command are detailed well here[https://gist.github.com/gaubert/822090].
They must be either set globally or set with commands separated by ;
Super great fine control

Latest revision as of 06:38, 17 September 2020

lftp -c "open 192.168.1.41:2121/Music; lcd /local/directory; mirror -R -P 3 --ignore-time --delete"

-c run a command

Separate all command with ;

mirror makes two directories identical. Default is remote to local

-R makes mirror local to remote

-P number specifies number of parallel connections

--ignore-time will only compare file size and existence

--continue will try again or resume if the connection fails.

--delete will remove files if no longer in the source.

lcd /local/directory; this is a separate command that specifies the local directory so that you can more easily script lftp otherwise it uses the current working directory.

pwd will print the working directory on the remote machine

lpwd will print the local working directory. That is where you ran the script from NOT what may be specified in the script.

lftp -c "set net:timeout 2 ; set net:max-retries 2 ; set net:reconnect-interval-base 5 ; open 192.168.1.41:2121/Music; lcd /local/directory; mirror -R -P 3 --ignore-time --delete --verbose"

The set command are detailed well here[1]. They must be either set globally or set with commands separated by ; Super great fine control