Why Does RoboCopy Create Hidden System Folders When Mirroring Entire Drives?


2 views

html

When using RoboCopy to mirror an entire drive (e.g., robocopy E: I:\E /MIR), you might notice the destination folder becomes hidden and marked as a system folder. This behavior doesn't occur when copying regular directories, only when working with drive roots.

The phenomenon occurs because RoboCopy preserves all file attributes from the source, including the system and hidden attributes that exist on drive roots. Windows automatically applies these attributes to drive letters in the filesystem hierarchy.

// Example showing attributes on a drive root
C:\> attrib
A    SHR     C:\

Option 1: Post-copy attribute modification

robocopy E: I:\E /COPYALL /MIR /R:0
attrib -S -H I:\E

Option 2: Selective attribute copying

// Use /COPY:DAT instead of /COPYALL
robocopy E: I:\E /COPY:DAT /MIR /R:0

For enterprise environments where you need both visibility and security:

robocopy E: I:\E /COPY:DATSO /MIR /R:0 /ZB /V /TEE /LOG+:robocopy.log
attrib -S -H I:\E /S /D
icacls I:\E /reset /T /C /L /Q

When building automated backup scripts, hidden destination folders can break:

  • File monitoring systems
  • Cloud sync clients
  • Permission inheritance chains

Always test attribute behavior when deploying new RoboCopy workflows, especially when using /MIR with drive roots.


During my recent data migration project, I encountered an unexpected RoboCopy behavior when mirroring entire drives. The command:

robocopy E: I:\E /COPYALL /E /R:0 /MIR /B /ETA

Successfully copied all data, but the destination folder became hidden and system-protected - requiring both Show hidden files enabled and Hide protected OS files disabled to view. The properties dialog showed no hidden attribute set, making this particularly confusing.

Through testing various scenarios, I identified the pattern:

  • Occurs when copying at drive root level (E:\ to I:\E)
  • Doesn't occur when copying subfolders (E:\Data to I:\Backup\Data)
  • Happens regardless of admin privileges

The issue stems from RoboCopy's handling of drive root attributes. Windows automatically applies system/hidden flags to drive root folders for legacy compatibility. When RoboCopy mirrors these at the destination, it preserves these special attributes.

For those needing visible destination folders, here are three approaches:

1. Post-Copy Attribute Modification

attrib -S -H I:\E /D /S

2. Alternative Mirror Command

robocopy E:\ I:\E /MIR /COPY:DAT /DCOPY:T /R:0 /NP /LOG:mirror.log
attrib -S -H I:\E

3. Subfolder Mirroring Approach

mkdir I:\E_Data
robocopy E:\ I:\E_Data /MIR /COPYALL /B /R:0
# Destination remains visible at I:\E_Data

This behavior connects to Windows' treatment of drive roots differently from regular folders. The system flag at drive roots affects:

  • Explorer.exe view settings
  • File system filter drivers
  • Backup software behavior

RoboCopy's /B (backup mode) flag particularly exacerbates this by forcing preservation of all attributes, including these special ones.

For scripted deployments, add this post-copy step:

:FixAttributes
attrib -S -H %DestinationDrive%\* /D /S
if %ERRORLEVEL% neq 0 (
    echo Failed to reset attributes >&2
    exit /b 1
)

Combine with RoboCopy logging for complete auditability:

robocopy %Source% %Dest% /MIR /ZB /NP /TEE /LOG+:%LogPath%