Avatar of rafaelrgl
rafaelrgl
 asked on

lftp to sync folders but do not keep files older than 30 days old on synced machine.

here is what I did:

lftp ftp://ftp.server.com <<- DOWNLOAD
    user user@ftp.com "password"
    set ssl:verify-certificate no
    mirror -cn / /localfolder;
    bye
DOWNLOAD

this script works perfect to get the root folder on the ftp and sync with local folder, but here is what I want to accomplish now. I want to keep in my local folder only files that are newer than 30 days old base on the creation date of the file. So here is the example. lets say we run the script, the script will go to the ftp and download only the files that are newer than 30 days old and we do not have it inside the local folder and we will delete files older than 30 days on local folder. How can I accomplish this?
LinuxShell Scripting

Avatar of undefined
Last Comment
rafaelrgl

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
noci

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
rafaelrgl

ASKER
perfect. works like its suppose to. thanks
Your help has saved me hundreds of hours of internet surfing.
fblack61