Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 ftp 位置,我需要编写 shell 脚本以在特定时间间隔内对其进行镜像。我将使用 Linux cron 设置计时器,但如何使用 ftp 将远程文件夹镜像到本地文件夹。
试试用这个......
#!/bin/bash
HOST='172.13.17.11'
USER='username'
PASS='password'
TARGETFOLDER='/mnt/htdocs/businessfiles/files'
SOURCEFOLDER='/somefolder'
lftp -f "
open $HOST
user $USER $PASS
lcd $TARGETFOLDER
mirror --verbose $SOURCEFOLDER $TARGETFOLDER
bye "`
bye