Announcing Recursive Command 0.2
December 30, 2007 – 4:13 pmOld Hard Drive + Remove All Permissions + Try to Access Drive = Permission Denied
Hmm…that’s a problem.
My uncle had an old hard drive in his computer with NTFS permissions that had been used as his primary hard drive with Windows XP on it at some point. Now it’s a secondary drive in his computer and he wants access to the files on that drive.
I removed all of the permissions on the drive, tried to set the current Administrators group as the owner, and got the following message:
You do not have permission to view the current permission settings for Local Disk (E:), but you can make permission changes.
Well, I couldn’t make permission changes…it lied! I told my boss the story and after a few minutes he found a little program called takeown.exe. You supply takeown.exe with the path you want it to take ownership of and it sets the owner to the administrators group. Perfect! Almost.
Apparently the permissions on my uncle’s hard drive were totally annihilated because after running “takeown e:” I could only access the root of the drive but none of its subdirectories. I checked for a recursive switch in the help but didn’t find one. So I wrote my own. I call it Recursive Command. You supply the base path and the command and it applies that command to every file and folder within that path.
Download Recursive Command 0.2
Recursive Command requires PHP to run (for now). If you don’t have PHP simply download the latest stable version from php.net’s download area and extract the files to C:\Program Files\PHP. You can really put these files anywhere but Recursive Command is setup to look for PHP at the aforementioned location.
Example: Suppose you want to take ownership of an entire hard drive (E:).
“C:\Program Files\PHP\php.exe” -f “C:\Program Files\RecursiveCommand\main.php” “C:\\Windows\\System32\\takeown.exe [current_path]” “E:”
Let me break down that command for you.
- “C:\Program Files\PHP\php.exe” -f “C:\Program Files\RecursiveCommand\main.php” – tells the system that you want the PHP interpreter to interpret main.php
- “C:\\Windows\\System32\\takeown.exe [current_path]” – the command you want to execute (note that all backslashes are doubled-up because PHP likes to mess them up) ([current_path] will automatically be replaced with the current path being evaluated).
- “E:” – the path you want the command to be recursively applied to.
I included a test.bat file with Recursive Command that you can modify so you don’t need to remember the long command above.
Please comment with your feature requests and reviews so I can make Recursive Command even better.
No related posts.
RSS Feed
2 Responses to “Announcing Recursive Command 0.2”
I was having trouble accessing my Word files, so I played around with permissions on the files individually and got them working. Then I got sick of doing each one and though (eroniously) that I should just go to the hard drive and do the same. The result is like you listed above.
I removed all of the permissions on the drive, tried to set the current Administrators group as the owner, and got the following message:
You do not have permission to view the current permission settings for Local Disk (D:), but you can make permission changes.
Like you, I couldn’t make permission changes either.
My problem is that I don’t know what I’m doing. I’ve tried to follow your instructions re: takeown.exe and Recursive Command, but I am lost and no closer to regaining control of my drive. I can’t get anything to work for me. Can you let me know what I have to do in a very basic way?
By Kevin
on Dec 21, 2008
Hi Kevin,
Were you able to install PHP successfully?
By Jeremy
on Dec 21, 2008