标签: ruby filesystems stat
鉴于目录./a和./b如何使用ruby将./b的权限和时间戳设置为与./a相同?
./a
./b
答案 0 :(得分:1)
touch命令(至少在Linux上)有一个-r选项:
touch
-r
-r, --reference=FILE use this file’s times instead of current time
您可以从Ruby程序中调用touch来执行您想要的操作。 chmod命令具有类似的标志。
chmod