I have never used xcopy, preferring robocopy
instead. Perusing it's options, obtained with Robocopy /?
these look interesting for what you'd be trying to do. The whole list of options might be overwhelming to some, so I tried to highlight those that might do what you need.
My Legend for this post: Bold
- some variants to definitely understand, because they are largely included in other groupingsGray Background
- maybe useful overall, but not germane to security,
- recommended Blue
- More explanation needed (i.e. I'm not sure of what this does).
:: Some RoboCopy options :
/S :: copy Subdirectories, but not empty ones.
/E :: copy subdirectories, including Empty ones.
/LEV:n :: only copy the top n LEVels of the source directory tree.
/Z :: copy files in restartable mode.
/B :: copy files in Backup mode.
/ZB :: use restartable mode; if access denied use Backup mode.
/J :: copy using unbuffered I/O (recommended for large files).
/EFSRAW :: copy all encrypted files in EFS RAW mode.
/COPY:copyflag[s] :: what to COPY for files (default is /COPY:ADT).
(copyflags : D=Data, A=Attributes, T=Timestamps, X=Skip alt data streams).
(S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
/SEC :: copy files with SECurity (equivalent to /COPY:ADTS).
/COPYALL :: COPY ALL file info (equivalent to /COPY:ADTSOU).
/NOCOPY :: COPY NO file info (useful with /PURGE).
/SECFIX :: FIX file SECurity on all files, even skipped files.
/TIMFIX :: FIX file TIMes on all files, even skipped files.
L.W. (Dan) Danz, Overland Park KS Reflect v8.1.7784+ on Windows 11 Home 23H2 22631.2715+
Reflect v8.1.7784+ on Windows 10 Pro 22H2 19045.3693+
Reflect v8.1.7638+ on Windows 10 Home 22H2 19045.3570+