设想情况:
来源脏:
/day1/hour1/instance1/files.ext
/day1/hour1/instance2/files.ext
/day1/hour1/instance3/files.ext
/day1/hour2/instance1/files.ext
/day1/hour2/instance2/files.ext等等。
目标dir (已经存在):
/day1/hour1/instance4/files.ext
/day1/hour1/instance5/files.ext
/day1/hour1/instance6/files.ext
/day1/hour2/instance6/files.ext
/day1/hour2/instance7/files.ext我必须把所有文件从源复制到目标。
正如您所看到的,我有一棵相同的树,这意味着相同的日子和相同的时间,但不同的实例来源和目标。我需要复制所有的dir和文件的来源,在同一棵树的目标,但保留所有的文件,已经在目标文件夹。
我怎样才能做到这一点?
cp -R是我需要的吗?还是我需要添加更多的参数?
发布于 2017-06-16 08:36:18
我想我会用rsync代替。使用rsync,您可以复制和同步数据。典型参数如下:
rsync -avh source destinationV用于对递归和保存文件权限、所有权和时间戳h进行详细的a表示,用于生成可读的输出数字。
https://unix.stackexchange.com/questions/371458
复制相似问题