in reply to Re^3: Finding out whether two directories are the same
in thread Finding out whether two directories are the same
will create a second directory with identical content, but dir1 and dir2 are different. You'd have to look at inode change time to see a difference, but even then, it's not a garantee.$ cp -a dir1 dir2
OTOH, even if you think the content is different, the directories may be the same. If the directories are the same, you'll be looking at the same directory twice, but since you cannot garantee you'll be looking twice at the same time, the directory, or any of its files inside it, may have changed between your two inspections.
Having said that, I don't think there's solution that will always work anywhere. But usually you will know a bit of the environment. If you know your filesystems are local, and no device is mounted twice, checking inode and device number will do. If you know the directories to be tested aren't being modified while you make your check, checking for content may work.
|
|---|