Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use Shell script to realize automatic upload and download of ftp under Linux

Shulou Source: shulou.com Published: 2022-06-03 07:47:19 11月15日 Update

Editor to share with you how to use Shell scripts under Linux to achieve automatic upload and download of ftp. I hope you will get something after reading this article. Let's discuss it together.

1. Ftp automatically logs in to download files in bulk.

The code is as follows:

# from / home/data on ftp server to local / home/databackup####

#! / bin/bash

Ftp-N2. Ftp automatically logs in to upload files.

The code is as follows:

# / home/data#### on the local / home/databackup to ftp server

#! / bin/bash

Ftp-n3. Ftp automatically logs in to download a single file.

The code is as follows:

# download / home/data/a.sh to local / home/databackup#### from ftp server

#! / bin/bash

Ftp-N4. Ftp automatically logs in to upload a single file.

The code is as follows:

# put the local / home/databachup/a.sh up ftp / home/databackup under #

#! / bin/bash

Summary of ftp-n: by saving the above script as a file and adding it to crontab, ftp can automatically upload and download files.

Notes:

1.-n is not affected by .netrc files. (ftp defaults to reading settings in .netrc files)

two。

Tags: Files codes logins scripts servers services uploads and downloads individual articles up and down done summary more flags logos annotations knowledge industry information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Linux vpn Shulou Tech Info Xiaomi