Problem deleting recup_dir folders after using Testdisk

Asked by Ricardo Diamondo on 2017-05-09

Recently I plugged an external HD into an android device which started re-formatting it. I quickly unplugged it and tried to recover the data on my laptop using Testdisk. I thought that I was recovering the data to another external HD (also plugged into a USB port), but the data has been recovering onto my laptop instead, which then ran out of space (after 6hrs). I then stopped Testdisk running. But now my laptop HD is clogged up with 2,410 recup_dir folders which are all locked. This has stopped me simply deleting them. How can I loose these folders and get some space back on my laptop? (Since this happened I have also lost my bookmarks list on Firefox and all saved passwords for sites). Please help!

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu testdisk Edit question
Assignee:
No assignee Edit question
Solved by:
Ricardo Diamondo
Solved:
2017-05-09
Last query:
2017-05-09
Last reply:
2017-05-09

Why is the data not backed up?

After 6 hours it seems to have just copied my laptop hard drive to itself! The data was backed up on the external HD which is what I have lost. Now I've noticed that LibreOffice Writer no longer works (I have un-installed it and re-installed it to no effect).

Please note that at this point I am not too worried about retrieving the lost data on the external HD, I am more worried about the clogging-up of the hard-drive on my laptop which is showing signs of corruption due to all the memory being used up. I just want to get rid of the locked recup_dir folders that I seem to have acquired.

Manfred Hampl (m-hampl) said : #4

What are the file protection settings of these recup_dir files?
If they are owned by root, then you probably can only delete them using the sudo command prefix (to temporarily gain administrative authorizations).

Thanks for your time Manfred. I managed to find that the owner & group permissions for these recup_dr files are all root.
Please can you tell me how to delete them using the Terminal?
I am a pensioner who can just about grok the basics...

Manfred Hampl (m-hampl) said : #6

Are those files plain files or directories?
What are their names?

Can you formulate a file selection command to list only those files and no other ones, probably something like
ls recup_dir.*
?

If this is listing only those files that you want to delete, then you can adapt this command, by replacing "ls" with "sudo rm"
e.g. perhaps
sudo rm recup_dir.*

Thanks.
The files have folder logo's (with a lock on it), but are called .dir....
There are 2,410 of these!
Can I delete with: sudo rm recup_dir. 1-2,410 ??? or is the * all that's needed?

Just tried sudo rm recup_dir.* but came up that it can't delete them as they are directories.
How can I delete directories?

Manfred Hampl (m-hampl) said : #9

There is the rmdir command to remove directory files, but only if the directories are empty (which I assume they aren't).

You can try using the rm command with additional options; that should work in your case.

Try
sudo rm -rf recup_dir.*

Just tried sudo rm -rf recup_dir.* but nothing happened after entering my password.

Sorry. It appeared that nothing had happened, but it did. Problem solved, thanks.

In Linux, no output means it worked. No news is good news.