How do I set the permissions and timestamps of one directory to match anothers?

StackOverflow https://stackoverflow.com/questions/23330436

  •  10-07-2023
  •  | 
  •  

سؤال

Given directory ./a and ./b how do I use ruby to set the permissions and timestamps of ./b to be the same as ./a?

هل كانت مفيدة؟

المحلول

The touch command (at least on Linux) has a -r option:

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

You can call touch from your Ruby program to do what you want. The chmod command has a similar flag.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top