Tag Info

New answers tagged

0

I ran into exactly this error while also trying to remove a directory (rm -r dirname). I had already tried all of the suggestions I've read here before I searched and found this thread. I do not know if there may have been any additional points unintentionally left unstated from the original question, but in my case the root of the trouble, and the ...


1

First: get that disk out of the machine, put it in an external USB case, and only use it to access data, don't ever write to it. Several months ago I partitioned an Ubuntu laptop and installed Windows on it. Then the owner told me to recover files from it. I used Photorec to recover the files. Almost all files were recovered. Filenames, paths to the file, ...


1

There are many tools for data recovery but the key here is to don't touch anything, create a live usb/cd on another machine and use that. I recommend testdisk it can be found on gparted liveCD. Both are free.


0

I had the same problem, and chmod alone didn't do the trick. I first had to change the owner (user and group) of the files I wanted to remove. sudo chown -hR root:admin dir_to_delete Explanation: sudo: make sure you have the proper rights chown: Linux command to change owner of a file -hR: change owner of directory and all subdirectories. I found it ...


1

An alternative. Same caveats apply as @Adam C's answer; don't run this without testing it. Some demo data: $ mkdir testing; cd testing $ mkdir one two three four "fi ve" $ touch one/one.txt two/two.txt three four/keep.txt fi\ ve/.hidden Simulate deleting all but four/ $ find . -mindepth 1 -path ./four -prune -o -exec echo would remove "{}" + Output: ...


3

WARNING: running any command to recursively delete files is dangerous. Always, always test before blindly running such dangerous commands, and never run them as the root user (or with sudo etc.), ever. This is relatively easy to do with a bit of bash, you could even make it an argument you pass in if you are going to do this a lot. But, for a once off, ...



Top 50 recent answers are included