linux 增量复制不同文件到另一个文件夹
1、脚本说明:
linux 增量复制不同文件到另一个文件夹。
用法:sh copy.sh 源目录 目标目录
#!/bin/sh if [ $# -ne 2 ]; then echo "Usage:./incremental_copy.sh source_dir destination_dir" exit 1 fi source_dir=$1 destination_dir=$2 for file in $(1s $source_dir); do if [ ! -f destination_dir/$file ]; then cp $source_dir/$file $destination_dir echo "copied $file to $destination_dir" fi done echo "Incremental copy complete'