如何设置一个目录的权限和时间戳以匹配其他目录?

时间:2014-04-27 23:48:16

标签: ruby filesystems stat

鉴于目录./a./b如何使用ruby将./b的权限和时间戳设置为与./a相同?

1 个答案:

答案 0 :(得分:1)

touch命令(至少在Linux上)有一个-r选项:

   -r, --reference=FILE
          use this file’s times instead of current time

您可以从Ruby程序中调用touch来执行您想要的操作。 chmod命令具有类似的标志。