How do I copy/move files WITHOUT retaining/preserving the security/sharing permissions?

39,425

Solution 1

The easiest is using robocopy with the right arguments. Robocopy is a robust copy program where you can specifically tell it how to copy the files. It would suit you using it like:

robocopy c:/source c:/destination /e

The "/e" parameter tells it to copy all subfolders and files. As there's no specification on how to copy, it'll only copy the files, no permissions or attributes.

To copy a single file:

robocopy c:/source c:/destination file.exe

Source: http://ss64.com/nt/robocopy.html

Solution 2

To get around the "Permission Denied Error 5" and ONLY copy the file without any other attributes use:

robocopy c:/source d:/destination *.* /COPY:D

/Copy:D means only copy data.

:D - Data

:A - Attributes

:T - TimeStamps

:S - Security

:O - Owner

:U - aUditing information

So:

robocopy c:/source d:/destination *.* /COPY:DATSOU

will copy Data, Attributes, Timestamps, Security, Owner, aUditing Info - Which is the same as /COPYALL

/COPY:copyflag[s] :: what to COPY (default is /COPY:DAT). (copyflags : D=Data, A=Attributes, T=Timestamps). (S=Security=NTFS ACLs, O=Owner info, U=aUditing info).

Share:
39,425

Related videos on Youtube

Hyflex
Author by

Hyflex

I'm unsure what to put here :/

Updated on September 18, 2022

Comments

  • Hyflex
    Hyflex over 1 year

    I'm trying to copy/move files from one hard drive to another hard drive but I do not want the security/sharing permissions to be copied over with the files; instead I want it to use generic/default permissions.

    How do I achieve this?

  • Hyflex
    Hyflex over 7 years
    Works perfectly, I also added /move to the end of it so that it deletes from the source folder once copied.