accidentally deleted ALL empty directories

Issues related to applications and software problems and general support
Post Reply
edwardsmarkf
Posts: 51
Joined: 2012/07/06 23:57:24

accidentally deleted ALL empty directories

Post by edwardsmarkf » 2021/01/09 19:42:47

hello -

being the total stupid idiot that i am, i accidentally ran a script that deleted ALL empty directories system-wide. :x (the script was supposed to accept a parm, but i forgot to first check to make sure the parm exists.)

now my hosting company apparently recoved the boot for me, thankfully.

so far, the only thing i needed to do was to issue:
mkdir -v /etc/modulefiles ;
mkdir -v /usr/share/modulefiles ;
mkdir -v /var/www/html ;
so it seems.

everything else seems to be fine.

is there anything else i might look at? (besides changing careers, please)

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: accidentally deleted ALL empty directories

Post by jlehtone » 2021/01/09 22:25:36

It is possible to verify the installed packages. (See man rpm):

Code: Select all

rpm -Va
That should reveal missing files/directories.

It is possible to reinstall a package with:

Code: Select all

yum reinstall packageName

desertcat
Posts: 843
Joined: 2014/08/07 02:17:29
Location: Tucson, AZ

Re: accidentally deleted ALL empty directories

Post by desertcat » 2021/01/10 22:47:12

edwardsmarkf wrote:
2021/01/09 19:42:47
hello -

being the total stupid idiot that i am, i accidentally ran a script that deleted ALL empty directories system-wide. :x (the script was supposed to accept a parm, but i forgot to first check to make sure the parm exists.)

[snip]
Nah, don't beat yourself up over this -- you are not a "total idiot". We've all done it at least once -- some of the ones that we've read about make yours look mild in comparison.

A good solution is to make sure you have a BACKUP!! A BACKUP will save you a lot of grief if there is TRUE disaster... like your HDD suddenly dies, rolling over the machine causes problems, for reasons unknown files become corrupted, etc.

Happy New Year!!

D'Cat

edwardsmarkf
Posts: 51
Joined: 2012/07/06 23:57:24

Re: accidentally deleted ALL empty directories

Post by edwardsmarkf » 2021/01/12 18:35:32

removed.
Last edited by edwardsmarkf on 2021/01/12 18:42:18, edited 1 time in total.

edwardsmarkf
Posts: 51
Joined: 2012/07/06 23:57:24

Re: accidentally deleted ALL empty directories

Post by edwardsmarkf » 2021/01/12 18:38:31

jlehtone wrote:
2021/01/09 22:25:36
It is possible to verify the installed packages. (See man rpm):

Code: Select all

rpm -Va
That should reveal missing files/directories.

It is possible to reinstall a package with:

Code: Select all

yum reinstall packageName
thank you jletone!

Code: Select all

rpm -Va | grep  missing  > repair.bsh ;
in repair.bsh i change all occurences of 'missing" to

Code: Select all

mkdir -vp
and that seemed to do the trick!

edwardsmarkf
Posts: 51
Joined: 2012/07/06 23:57:24

Re: accidentally deleted ALL empty directories

Post by edwardsmarkf » 2021/01/12 18:41:53

desertcat wrote:
2021/01/10 22:47:12
edwardsmarkf wrote:
2021/01/09 19:42:47
hello -

being the total stupid idiot that i am, i accidentally ran a script that deleted ALL empty directories system-wide. :x (the script was supposed to accept a parm, but i forgot to first check to make sure the parm exists.)

[snip]
Nah, don't beat yourself up over this -- you are not a "total idiot". We've all done it at least once -- some of the ones that we've read about make yours look mild in comparison.

A good solution is to make sure you have a BACKUP!! A BACKUP will save you a lot of grief if there is TRUE disaster... like your HDD suddenly dies, rolling over the machine causes problems, for reasons unknown files become corrupted, etc.

Happy New Year!!

D'Cat
D'cat - had this been merely the first time i have done something like this, i would agree. fortunately this one only went after all empty directories. the last time i accidentally ran a script that did:

Code: Select all

##rm -Rf //;  NOTICE THIS IS COMMENTED OUT!
i agree with the backing up, i backup all the user stuff frequently, but not the entire server.

Post Reply