Synapse Syndrome said:
I want to find any folders on a drive that the Administrator account may
not be able to access. What CACLS command should I use for this?
Cheers
ss.
I don't think that a raw cacls command can do this. However, the batch file
below might do the job. It will identify all folders whose ACL does not
include "Administrator" or "Everyone".
01. @echo off
02. set User=Administrator
03. set Target=E:\Backup Folder
04. set Logfile=c:\cacls.txt
05.
06. echo Permission list compiled on %date% at %time% > %Logfile%
07. echo List of folders whose ACL includes neither %User% nor "Everyone" >>
%Logfile%
08. echo. >> %Logfile%
09. echo Compiling the permission list. Please wait . . .
10. for /F "delims=" %%a in ('dir /b /s /ad "%Target%"') do (
11. echo Processing "%%a"
12. cacls "%%a" | findstr /i "%User% Everyone" > nul || echo %%a >>
%Logfile%
13. )
14. notepad %Logfile%
The batch file works recursively. To speed up its operation, remote the "/s"
switch in Line #10 to make it non-recursive.