Preserving Creation and Modified Timestamps when Moving Files and Directories with Robocopy

Abstract: Use Robocopy with the /MOV flag to move files and directories while preserving original creation and modified timestamps.

Created: 2026-09-22 by

Use the /MOV flag to move files and directories with Robocopy while preserving creation and modified timestamps. By default, Robocopy preserves timestamps during copy operations, but when moving, it is crucial to ensure no flags like /R:0 or specific error handling interfere with the metadata retention. This approach ensures that file history remains intact across the transfer.

Understanding Robocopy Timestamp Behavior

Robocopy (Robust File Copy) is a command-line directory mirroring tool that comes pre-installed with Windows Server operating systems and is available on modern Windows client versions as part of the Windows Resource Kit or newer updates. One of its most powerful features is the ability to preserve file attributes, including timestamps, permissions, and ownership information. However, understanding how these attributes are handled during different operations is essential for data integrity. When you perform a standard copy operation using the /COPY flag, Robocopy defaults to copying Data, Attributes, Timestamps, Security (NTFS ACLs), Owner information, and Audit information. The timestamp preservation is inherent to this default behavior. The key challenge arises when switching from a "copy" operation to a "move" operation, as users often worry that moving files might reset their modification dates to the time of the move rather than retaining the original creation and last-modified times. It is important to note that Robocopy does not have a dedicated flag solely for "preserving timestamps." Instead, timestamp preservation is a baseline feature of the copy engine. Therefore, the strategy for moving files while keeping timestamps relies on correctly combining the move command with the default copy settings. If you inadvertently use flags that reset attributes or alter security descriptors, you might observe unexpected changes in file metadata. Thus, the solution involves using the move flag without overriding the default attribute preservation.

The /MOV Flag Explained

The /MOV switch tells Robocopy to move files and directories after they are successfully copied. This is distinct from the /MOVE flag, which moves both files and subdirectories, including empty ones. For most scenarios where you want to preserve the structure and timestamps of a directory tree, /MOV is sufficient. It performs a two-step process: first, it copies the file to the destination, and second, it deletes the source file. Because the copy step uses the default settings, the timestamps are preserved during the initial write. Once the copy is verified as successful, the deletion occurs. The critical point is that the timestamp stored in the destination file is the one from the source, not the current system time. This ensures that your file history, backups, and version control systems relying on timestamps remain accurate.

Constructing the Command

To execute a move operation that preserves timestamps, you need to construct a command that specifies the source, destination, and the move flag. Below is the basic syntax:
robocopy <Source> <Destination> /MOV
For example, if you are moving files from C:\OldData to D:\NewData, the command would be:
robocopy C:\OldData D:\NewData /MOV
This command will iterate through all files in C:\OldData, copy them to D:\NewData with their original timestamps intact, and then delete the originals. If you also need to include empty directories in the move operation, you should add the /E flag, which copies subdirectories including empty ones. Combining these, the command becomes:
robocopy C:\OldData D:\NewData /MOV /E
By using /E with /MOV, you ensure that the entire directory structure, including nested empty folders, is transferred. The timestamps for all files within those directories will be preserved because the underlying copy mechanism retains the default timestamp preservation behavior.

Verifying Timestamp Preservation

After running the command, it is good practice to verify that the timestamps were indeed preserved. You can do this by comparing the output of the dir command on both the source and destination directories before the move completes, or by checking the destination files after the move. Look at the "Modified" and "Created" columns in the directory listing. They should match the original source files exactly. If you notice discrepancies, check if any other flags were added to the command. Flags such as /DCOPY:T explicitly control directory timestamp copying, but since we are dealing with files, the default /COPY:DAT (Data, Attributes, Timestamps) is what matters. Avoid using flags like /XF or /XD unless necessary, as they filter files and directories but do not affect timestamp logic directly. However, always ensure that you are not using /COPY:DA exclusively, which might omit timestamps depending on the version and context, although the default is comprehensive.

Common Pitfalls and Best Practices

One common mistake is assuming that /MOVE behaves differently regarding timestamps than /MOV. In reality, both rely on the same copy engine. The difference is purely in whether empty directories are included. Another pitfall is network latency. When moving files over a network, the copy phase can take significant time. Ensure that the network connection is stable to prevent partial copies, which could lead to errors and potentially missing files, though timestamps on successful copies will remain correct. Additionally, consider the impact of file permissions. If the destination folder has restrictive permissions, Robocopy might fail to write the file, even if the source allows it. In such cases, the move fails, and no file is deleted from the source. To avoid this, ensure that the user account running Robocopy has write access to the destination directory. For more complex migrations involving large datasets or external drives, refer to guides on Transferring ISO Files using ROBOCOPY: A Guide for Virtual IODD External Encrypted Enclosures and Sabrent SATA Drivers for insights on handling storage-specific constraints. Another consideration is the handling of read-only files. Robocopy can handle read-only files by default, but if you encounter issues, you might need to adjust the attributes. However, changing attributes is not required for timestamp preservation. Always test with a small subset of files first to confirm that the timestamps are behaving as expected before running full-scale moves. For scenarios where you need to clean up files during a transfer, such as deleting temporary files, you might look into processes like How to Delete a File During SFTP Copy Process to understand broader file management strategies, although Robocopy handles deletion internally upon successful copy.

Advanced Options for Timestamp Control

While the default behavior preserves timestamps, advanced users may want explicit control. You can use the /COPYALL flag, which is equivalent to /COPY:DATSOA (Data, Attributes, Timestamps, Security, Owner, Audit). This ensures that every aspect of the file metadata is copied. Although /MOV already implies a full copy, using /COPYALL makes the intent explicit and prevents any ambiguity about what is being transferred.
robocopy C:\OldData D:\NewData /MOV /COPYALL /E
This command is robust for enterprise environments where audit trails and strict metadata retention are required. It guarantees that not only timestamps but also security descriptors and ownership information are moved along with the files. This is particularly useful when migrating data between servers with different security policies. In conclusion, preserving creation and modified timestamps when moving files with Robocopy is straightforward. By using the /MOV flag, possibly combined with /E for empty directories and /COPYALL for explicit metadata inclusion, you can ensure that file history is maintained. Always verify the results and ensure proper permissions to avoid complications.

Frequently Asked Questions

Does Robocopy reset timestamps when moving files?

No, Robocopy does not reset timestamps when moving files. It preserves the original creation and modified timestamps during the copy phase, which precedes the deletion of the source file.

What is the difference between /MOV and /MOVE?

/MOV moves files and non-empty directories, while /MOVE moves both files and empty directories. Both preserve timestamps equally well.

Can I preserve timestamps when copying files over a network?

Yes, timestamp preservation works over network paths just as it does for local drives, provided the network connection is stable and permissions allow the copy operation.

Why are my timestamps not updating after a move?

Timestamps should not update; they should remain identical to the source. If they appear unchanged, this is the correct behavior indicating successful preservation.

Are there risks associated with using /COPYALL?

Using /COPYALL transfers security descriptors and ownership information, which might cause permission issues if the destination server has different domain structures or user accounts.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More