Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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。

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report