给文件/目录相同的修改日期 [英] Giving a file/directory the same modification date as another

查看:38
本文介绍了给文件/目录相同的修改日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在基于Unix的系统中将修改日期和时间从一个文件/目录复制到另一个文件/目录?

How do I "copy" the modification date and time from one file/dir to another in Unix-based systems?

推荐答案

您有一些选择:

  • 如果要更改时间,请使用 touch -t STAMP -m文件
  • 如果要复制文件并希望保留时间,请使用 cp --preserve = timestamps
  • 使用 touch -r 将时间设置为参考"文件
  • Use touch -t STAMP -m file if you want to change the time
  • Use cp --preserve=timestamps if you're copying the files and want to preserve the time
  • Use touch -r to set the time to a "reference" file

这篇关于给文件/目录相同的修改日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆