排序算法及不同场景应用总结
2026/6/16 3:18:01
FTP 常见用途之一是确保本地目录副本与 Web 服务器上的远程副本同步,即内容镜像。基本思路是进入特定本地目录,指定远程服务器和目录,按需将一个目录中的更改复制到另一个目录。
#!/bin/sh # ftpsyncup - Given a target directory on an ftp server, makes sure that # all new or modified files are uploaded to the remote system. Uses # a timestamp file ingeniously called .timestamp to keep track. timestamp=".timestamp" tempfile="/tmp/ftpsyncup.$$" count=0 trap "/bin/rm -f $tempfile" 0 1 15 # zap tempfile on exit &sigs if [ $# -eq 0 ] ; then echo "Usage: $0 user@host { remotedir }" >&2 exit 1 fi user="$(echo $1 | cut -d@ -f1)" server="$(echo $1 | cut -d@ -f2)" echo "open $server" > $tempfi