How to use lftp to delete old files before downloading new?use drivers from old kernel in new kernelRun LFTP...
Feedback diagram
What is the reason behind water not falling from a bucket at the top of loop?
How to transform a function from f[#1] to f[x]
Different answers of calculations in LuaLaTeX on local computer, lua compiler and on overleaf
Is the first page of Novel really that important?
What does Argus Filch specifically do?
Is this popular optical illusion made of a grey-scale image with coloured lines?
Astable 555 circuit not oscillating
In a KP-K endgame, if the enemy king is in front of the pawn, is it always a draw?
How to avoid a lengthy conversation with someone from the neighborhood I don't share interests with
What is a summary of basic Jewish metaphysics or theology?
Why do my fried eggs start browning very fast?
C# TCP server/client class
Why wasn't interlaced CRT scanning done back and forth?
how to change ^L code in many files in ubuntu?
Accurately recalling the key - can everyone do it?
How to call made-up data?
Generate random number in Unity without class ambiguity
Approximating an expression for a potential
What is the most 'environmentally friendly' way to learn to fly?
Declaring a visitor to the UK as my "girlfriend" - effect on getting a Visitor visa?
What license to choose for my PhD thesis?
Solve equations with condition on variable to reduce the number of solutions
Subverting the essence of fictional and/or religious entities; is it acceptable?
How to use lftp to delete old files before downloading new?
use drivers from old kernel in new kernelRun LFTP on a list of filesGet latest files with lftpLFTP Script to Download Fileslftp: removes folder prefix while uploading fileslftp logging of removed source filesCan't use LFTP with SFTP but SFTP clients allow connectionsLFTP: want to make sure I am going to use LFTP correctlyLFTP Script to Download files and remember old downloadsLFTP - Remove files from remote server while uploading via lftp mirror --reverse
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I am running lftp on Raspbian
I have 100GB of content on the remote site and 100GB space available on my SD card so I need to delete files not present at the remote site from the SD card before downloading new content.
How can I achieve this?
#!/bin/bash
login="username"
pass="password"
host="server.feralhosting.com"
remote_dir="/folder/you/want/to/copy"
local_dir="/cygdrive/s/lftp/somefolder/where/you.want/your/files/"
base_name="$(basename "$0")"
lock_file='/tmp/'"$base_name"'.lock'
trap 'rm -f '"$lock_file"'' SIGINT SIGTERM
if [[ -e "$lock_file" ]]
then
echo "$base_name is running already."
exit 1
else
touch "$lock_file"
lftp -u $login,$pass $host << EOF
set ftp:ssl-allow no
set mirror:use-pget-n 5
mirror -c -P5 --log='/var/log/'"$base_name"'.log' "$remote_dir" "$local_dir"
quit
EOF
rm -f "$lock_file"
trap - SIGINT SIGTERM
exit 0
fi
raspbian lftp
bumped to the homepage by Community♦ 42 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am running lftp on Raspbian
I have 100GB of content on the remote site and 100GB space available on my SD card so I need to delete files not present at the remote site from the SD card before downloading new content.
How can I achieve this?
#!/bin/bash
login="username"
pass="password"
host="server.feralhosting.com"
remote_dir="/folder/you/want/to/copy"
local_dir="/cygdrive/s/lftp/somefolder/where/you.want/your/files/"
base_name="$(basename "$0")"
lock_file='/tmp/'"$base_name"'.lock'
trap 'rm -f '"$lock_file"'' SIGINT SIGTERM
if [[ -e "$lock_file" ]]
then
echo "$base_name is running already."
exit 1
else
touch "$lock_file"
lftp -u $login,$pass $host << EOF
set ftp:ssl-allow no
set mirror:use-pget-n 5
mirror -c -P5 --log='/var/log/'"$base_name"'.log' "$remote_dir" "$local_dir"
quit
EOF
rm -f "$lock_file"
trap - SIGINT SIGTERM
exit 0
fi
raspbian lftp
bumped to the homepage by Community♦ 42 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am running lftp on Raspbian
I have 100GB of content on the remote site and 100GB space available on my SD card so I need to delete files not present at the remote site from the SD card before downloading new content.
How can I achieve this?
#!/bin/bash
login="username"
pass="password"
host="server.feralhosting.com"
remote_dir="/folder/you/want/to/copy"
local_dir="/cygdrive/s/lftp/somefolder/where/you.want/your/files/"
base_name="$(basename "$0")"
lock_file='/tmp/'"$base_name"'.lock'
trap 'rm -f '"$lock_file"'' SIGINT SIGTERM
if [[ -e "$lock_file" ]]
then
echo "$base_name is running already."
exit 1
else
touch "$lock_file"
lftp -u $login,$pass $host << EOF
set ftp:ssl-allow no
set mirror:use-pget-n 5
mirror -c -P5 --log='/var/log/'"$base_name"'.log' "$remote_dir" "$local_dir"
quit
EOF
rm -f "$lock_file"
trap - SIGINT SIGTERM
exit 0
fi
raspbian lftp
I am running lftp on Raspbian
I have 100GB of content on the remote site and 100GB space available on my SD card so I need to delete files not present at the remote site from the SD card before downloading new content.
How can I achieve this?
#!/bin/bash
login="username"
pass="password"
host="server.feralhosting.com"
remote_dir="/folder/you/want/to/copy"
local_dir="/cygdrive/s/lftp/somefolder/where/you.want/your/files/"
base_name="$(basename "$0")"
lock_file='/tmp/'"$base_name"'.lock'
trap 'rm -f '"$lock_file"'' SIGINT SIGTERM
if [[ -e "$lock_file" ]]
then
echo "$base_name is running already."
exit 1
else
touch "$lock_file"
lftp -u $login,$pass $host << EOF
set ftp:ssl-allow no
set mirror:use-pget-n 5
mirror -c -P5 --log='/var/log/'"$base_name"'.log' "$remote_dir" "$local_dir"
quit
EOF
rm -f "$lock_file"
trap - SIGINT SIGTERM
exit 0
fi
raspbian lftp
raspbian lftp
asked Jan 19 '17 at 8:37
AnthonyAnthony
1639 bronze badges
1639 bronze badges
bumped to the homepage by Community♦ 42 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 42 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 42 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I found the solution.
Add the --delete-first option, so this:
mirror -c -P5 --log='/var/log/'"$base_name"'.log' "$remote_dir" "$local_dir"
becomes this:
mirror -c -P5 --delete-first --log='/home/osmc/'"$base_name"'.log' "$remote_dir" "$local_dir"
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f338559%2fhow-to-use-lftp-to-delete-old-files-before-downloading-new%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I found the solution.
Add the --delete-first option, so this:
mirror -c -P5 --log='/var/log/'"$base_name"'.log' "$remote_dir" "$local_dir"
becomes this:
mirror -c -P5 --delete-first --log='/home/osmc/'"$base_name"'.log' "$remote_dir" "$local_dir"
add a comment |
I found the solution.
Add the --delete-first option, so this:
mirror -c -P5 --log='/var/log/'"$base_name"'.log' "$remote_dir" "$local_dir"
becomes this:
mirror -c -P5 --delete-first --log='/home/osmc/'"$base_name"'.log' "$remote_dir" "$local_dir"
add a comment |
I found the solution.
Add the --delete-first option, so this:
mirror -c -P5 --log='/var/log/'"$base_name"'.log' "$remote_dir" "$local_dir"
becomes this:
mirror -c -P5 --delete-first --log='/home/osmc/'"$base_name"'.log' "$remote_dir" "$local_dir"
I found the solution.
Add the --delete-first option, so this:
mirror -c -P5 --log='/var/log/'"$base_name"'.log' "$remote_dir" "$local_dir"
becomes this:
mirror -c -P5 --delete-first --log='/home/osmc/'"$base_name"'.log' "$remote_dir" "$local_dir"
answered Jan 28 '17 at 21:01
AnthonyAnthony
1639 bronze badges
1639 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f338559%2fhow-to-use-lftp-to-delete-old-files-before-downloading-new%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown