0

I have a NAS with a bunch of files I dont want to loose and a linux VPS with 250GB space off site.

The NAS runs an FTPS server. The VPS runs Debian/Linux

I want the VPS to copy/mirror all the contents from the FTPS to a local folder once per week. By this I mean:

  1. On first run copy all files that are in a specified folder on the FTPS to a local folder (including sub folders)

  2. On the second run add all new files that are either updated (different size or modified date)

  3. Delete all local files on the VPS that are no longer available on the FTPS server.

  4. Never touch the contents on the FTPS/NAS server

I'm sure there must be some script or program I can use to solve this. The ones I've found so far are either for windows or don't support FTPS.

JensB
  • 259
  • 1
  • 3
  • 15

1 Answers1

1

You can use lftp (man lftp) client compiled with SSL support. It has a mirror command which mirrors specified source directory to local target directory. This command has additional options such delete files not present on remote site which you need.A basic usage of this command can be:

# run this from VPS
# where to mirror data from SFTP server
cd vps_dir

# mirror data
lftp -u username,password -e "cd remote_dir; mirror --delete; quit" sftp://FTP_SERVER
dsmsk80
  • 5,817
  • 18
  • 22