This is in a Windows environment. I have an issue on a NAS volume where the Administrator has lost all access to various folders and files. I can find the offending folders and files and have been using batch files to grant ownership to the administrator account and then granting the access, but have a problem with nested folders. So if we have -
"h:\folder1\folder2\folder3\folder4" where EACH folder is not accessible or owned by Administrator
I list the folders into a txt file and then edit to run the commands to grant ownership in a batch file thus -
fileacl h:\folder1 /O Administrator:F
fileacl h:\folder1\folder2 /O Administrator:F
fileacl h:\folder1\folder2\folder3 /O Administrator:F
fileacl h:\folder1\folder2\folder3\folder4 /O Administrator:F
then I edit to create the following to grant access -
fileacl h:\folder1 /G Administrator:F
fileacl h:\folder1\folder2 /G Administrator:F
fileacl h:\folder1\folder2\folder3 /G Administrator:F
fileacl h:\folder1\folder2\folder3\folder4 /G Administrator:F
The problem is that only folder1 will be fixed as I won't have access UNTIL the second command is completed to touch folder2. Same for 3 & 4.
My question is - is it possible to execute two commands per line of the created text file listing so that it would execute both commands for folder1 before moving on to folder 2 and so on? Manually copying a& organizing this all would take forever as I have several thousand nested folders. A FOR loop in DOS/CMD prompt?