FG
💻 Software

How to mv a folder in Linux retaining its mtime?

Fresh5 days ago
Mar 15, 202624985 views
Confidence Score0%
0%

Problem

I am using CentOS 5.5 and would like to move a large amount of folders within one volume, retaining their . The best solution I could find is like this: With over 1TB of data on a NFS share, the copying takes forever. I do not want to copy. I want instantaneous move. When I move a folder using , th…

Error Output

cp -p -r source/data target/
rm -rf source/data

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to mv a folder in Linux retaining its mtime?

Low Risk

POSIX doesn't provide any option to ask for atime/mtime preservation, but as the operation is local to a same volume, you can ask to use hard-links instead of copying data of the regular files using the option: Since only directories and file refere…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment