I am bullet proofing a script to supervise the removal of all traces of a security application in preparation for the clean install of an upgrade.
I have a list of paths, each of which terminates with a list of folders and files to be removed. That is no problem - job done ! !
Unfortunately when all traces are removed the upgrade will FAIL if any folder/file is not removed because it cannot be seen because of a lack of access to any portion of the path.
I can easily try "MD C:\A\B\C\D\E\F" to test whether there may be permission issues to prevent a clean install. This would be a nice bonus if I can "throw it in free".
Unfortunately if "MD C:\A\B\C\D\E\F" is successful then I ought to "do no harm" and restore the previous status quo.
"RD C:\A\B\C\D\E\F" only removes the "\F" tail, whilst MD could have appended "\D\E\F".
Various people with various XP/VISTA/etc have listed various paths and items that need purging - hardly a %USERPROFILE% in any of them.
If MD has created relevant paths for both XP and VISTA, then after the RD there will be almost complete VISTA paths extra on XP, and almost complete XP paths extra on VISTA.
I therefore wish to predict whether it is possible to create a specific path before it is done.
CACLS gives me some clues about some access restrictions, and other numbers apply to both creatable and UNcreatable folders.
CACLS "C:\A\B\C\D\E\F" gives the following results :-
%ERRORLEVEL% = 2 when "F" does not exist - MD will make it;
%ERRORLEVEL% = 3 when "E\F" do not exist - MD will make it;
%ERRORLEVEL% = 267 if "F" cannot exist when "E" is a file, MD will never correct that;
%ERRORLEVEL% = 3 if "E\F" cannot exist when "D" is a file, MD will never correct that;
%ERRORLEVEL% = 5 if "E" is different user profile with no access, MD will never correct that;
%ERRORLEVEL% = 3 if "D" is a folder with no access, MD will never correct that;
Has anyone any ideas about SIMPLE alternative tests.
This is only a "FREE BONUS" that I do NOT need to include in an un-install script,
and I am not prepared at this stage to parse the path into individual folders and test the accessibility of each folder for a permissions blockage.
I have more than enough complexity with REG.EXE telling me all sorts of lies when I try to delete a key -
with one breath it tells me on the console stream success because the key exists,
and with the same breath on the error console it tells me of sub-keys which are access denied,
whilst %ERRORLEVEL% == 0 whenever the console stream says anything and it ignores the error stream.
regards
Alan