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

Ruby 如何设置一个目录的权限和时间戳以匹配其他目录?,ruby,filesystems,stat,Ruby,Filesystems,Stat,给定目录/a和/b如何使用ruby将/b的权限和时间戳设置为与/a相同?触摸命令(至少在Linux上)具有-r选项: -r, --reference=FILE use this file’s times instead of current time 您可以从Ruby程序中调用touch,以执行所需操作。chmod命令具有类似的标志

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

触摸
命令(至少在Linux上)具有
-r
选项:

   -r, --reference=FILE
          use this file’s times instead of current time
您可以从Ruby程序中调用
touch
,以执行所需操作。
chmod
命令具有类似的标志