Difference between revisions of "Deleting Too Long Folder and its Containing Tree"
(Created page with "OK, so you can create a folder name that is too long for most of the Windows applications, including Explorer, to deal with. Good old Windows :-) My web generation application,...") |
|||
Line 1: | Line 1: | ||
− | OK, so you can create a folder name that is too long for most of the Windows applications, including Explorer, to deal with. Good old Windows :-) My web generation application, Jalbum, creates folders from title text on a page. I had one called "On the second day, we visited the Museum of Antiquities in Cairo. Cameras were not allowed inside, but I took some pictures in the garden. In the evening, we were hosted by a Cairo family and served a very nice meal." Knowing this, I will now shorten up some of this commentary. I have a job that runs every few minutes to copy all of my photo stuff to an external drive. Since my backup drive was getting full, I decided to use a different one. After making a full copy to the new place, I went to delete the old one, and everything worked until it got to this long folder. I could not delete it with Explorer, with a command line, or with PowerShell. A little web research told me that I should use the application that originally created it. Well, that was RoboCopy, which I run in Batch to do this periodic copy. So I created an empty folder and used RoboCopy from the command line to duplicate the empty folder the the one containing the stubborn folder with too long a name. That worked. But now, I was not able to delete the top level folder that contained the whole thing. It kept saying that I needed permission from ejbdesk1\eburdick, which, or course, is me. I changed the ownership of the folder to Administrators and ran Explorer as Administrator. Same problem. Now, even though I was running as Administrator, I needed permission from myself. More web research revealed that I needed to change the Access Control List entry for the folder. Not something that most people ever even see. The instructions follow: | + | [[Ejbdesk1-maintenance-log | Back to Maintenance log]] |
+ | |||
+ | ==Windows Stupidity - creating something you cannot delete== | ||
+ | |||
+ | OK, so it turns out you can create a folder name that is too long for most of the Windows applications, including Explorer, to deal with. Good old Windows :-) My web generation application, Jalbum, creates folders from title text on a page. I had one called "On the second day, we visited the Museum of Antiquities in Cairo. Cameras were not allowed inside, but I took some pictures in the garden. In the evening, we were hosted by a Cairo family and served a very nice meal." Knowing this, I will now shorten up some of this commentary. I have a job that runs every few minutes to copy all of my photo stuff to an external drive. Since my backup drive was getting full, I decided to use a different one. After making a full copy to the new place, I went to delete the old one, and everything worked until it got to this long folder. I could not delete it with Explorer, with a command line, or with PowerShell. A little web research told me that I should use the application that originally created it. Well, that was RoboCopy, which I run in Batch to do this periodic copy. So I created an empty folder and used RoboCopy from the command line to duplicate the empty folder the the one containing the stubborn folder with too long a name. That worked. But now, I was not able to delete the top level folder that contained the whole thing. It kept saying that I needed permission from ejbdesk1\eburdick, which, or course, is me. I changed the ownership of the folder to Administrators and ran Explorer as Administrator. Same problem. Now, even though I was running as Administrator, I needed permission from myself. More web research revealed that I needed to change the Access Control List entry for the folder. Not something that most people ever even see. The instructions follow: | ||
#Right-click on folder -> Properties | #Right-click on folder -> Properties |
Revision as of 16:17, 22 April 2011
Windows Stupidity - creating something you cannot delete
OK, so it turns out you can create a folder name that is too long for most of the Windows applications, including Explorer, to deal with. Good old Windows :-) My web generation application, Jalbum, creates folders from title text on a page. I had one called "On the second day, we visited the Museum of Antiquities in Cairo. Cameras were not allowed inside, but I took some pictures in the garden. In the evening, we were hosted by a Cairo family and served a very nice meal." Knowing this, I will now shorten up some of this commentary. I have a job that runs every few minutes to copy all of my photo stuff to an external drive. Since my backup drive was getting full, I decided to use a different one. After making a full copy to the new place, I went to delete the old one, and everything worked until it got to this long folder. I could not delete it with Explorer, with a command line, or with PowerShell. A little web research told me that I should use the application that originally created it. Well, that was RoboCopy, which I run in Batch to do this periodic copy. So I created an empty folder and used RoboCopy from the command line to duplicate the empty folder the the one containing the stubborn folder with too long a name. That worked. But now, I was not able to delete the top level folder that contained the whole thing. It kept saying that I needed permission from ejbdesk1\eburdick, which, or course, is me. I changed the ownership of the folder to Administrators and ran Explorer as Administrator. Same problem. Now, even though I was running as Administrator, I needed permission from myself. More web research revealed that I needed to change the Access Control List entry for the folder. Not something that most people ever even see. The instructions follow:
- Right-click on folder -> Properties
- Security Tab
- Click on Advanced button
- Owner tab
- Edit.. button
- select Administrators in 'Change owner to', check 'replace owner on subcontainers and objects'
- Open cmd.exe as administrator
- this is "command prompt" under Accessories.
- you open as administrator by right clicking the program and picking "open as administrator"
- type 'cacls x:\Camera-buf /T /e /g Administrators:f'
- this is the command to change ACLs (access control lists) on the folder.
- /T means change the ACLs of the specified files in the current directory and all subdirectories.
- /e means edit the ACL instead of replacing it
- /g Administrators:f means grant full control to user Administrators
- rmdir /S x:\Camera-buf
- the is the command to remove a directory (folder)