Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在bashshell中将一个目录的时间戳信息复制到另一个目录_Bash_Shell - Fatal编程技术网

如何在bashshell中将一个目录的时间戳信息复制到另一个目录

如何在bashshell中将一个目录的时间戳信息复制到另一个目录,bash,shell,Bash,Shell,在bashshell中,如何将一个目录的时间戳信息复制到另一个目录 谢谢你的帮助 cd /path/to/dir1 && find . -exec touch --reference={} /path/to/dir2/{} \; 这将从/path/to/dir1到/path/to/dir2中的所有文件、目录等复制时间戳信息,前提是它们具有相同的名称 这将从/path/to/dir1到/path/to/dir2中的所有文件、目录等复制时间戳信息,如果它们有相同的名称。touch-

在bashshell中,如何将一个目录的时间戳信息复制到另一个目录

谢谢你的帮助

cd /path/to/dir1 &&
find . -exec touch --reference={} /path/to/dir2/{} \;
这将从
/path/to/dir1
/path/to/dir2
中的所有文件、目录等复制时间戳信息,前提是它们具有相同的名称


这将从
/path/to/dir1
/path/to/dir2
中的所有文件、目录等复制时间戳信息,如果它们有相同的名称。

touch-r source dir target dir

touch-r source dir target dir

什么操作系统和文件系统?@nmichaels:让我们说一下我的macbook pro的标准MacOS。什么操作系统和文件系统?@nmichaels:让我们说一下我的macbook pro的标准MacOS。