Resetting folder tree with icacls, excluding start folder

  acl, icacls, ntfs, windows

On a Windows machine using NTFS file system, I’d like to reset all files and subfolders ACLs, excluding the "starting" folder itself. For instance, say one wants to reset all files and subfolders in c:usersmikedesktop , leaving desktop folder unchanged (only the folder, while files and subfolders must be also reset within desktop folder)

Unfortunately, using the following command, also the desktop folder itself is being reset:

icacls "c:usersmikedesktop*" /reset /t /c /l /q

I could acheive this using Powershell, which is much slower that icacls

Source: Windows Questions

LEAVE A COMMENT