LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Removing a Specific Dir From All /home Dir (http://www.linuxquestions.org/questions/linux-general-1/removing-a-specific-dir-from-all-home-dir-648067/)

carlosinfl 06-09-2008 12:32 PM

Removing a Specific Dir From All /home Dir
 
I am moving everyone's home directory from server_old to server_new.

Code:

[root@server_old carlwill]# ls -la
total 52
drwx------    4 carlwill it_dept  4096 Apr 16  2007 .
drwxr-xr-x  420 root      root  16384 Jun  9 08:53 ..
-rw-r--r--    1 carlwill it_dept    24 Oct 18  2006 .bash_logout
-rw-r--r--    1 carlwill it_dept  191 Oct 18  2006 .bash_profile
-rw-r--r--    1 carlwill it_dept  124 Oct 18  2006 .bashrc
-rw-r--r--    1 carlwill it_dept  120 Oct 18  2006 .gtkrc
drwxr-xr-x    3 carlwill it_dept  4096 Oct 18  2006 .kde
drwx------    9 carlwill it_dept  4096 Apr 16  2007 data

My question is can I simply run rm -rf *.kde to delete everyone's .kde hidden directory in their home dir? The new server does not have KDE and I don't want to migrate over useless files / folders especially on a critical server like this one.

I know if I remove KDE from server_old, that will not remove their ~/.kde directories sadly unless there is a switch I am unaware of.

Anyone know what the best course of action would be? I am trying to delete the two .directories in red on all 500 users on this server...

anomie 06-09-2008 12:43 PM

Quote:

Originally Posted by Carlwill
My question is can I simply run rm -rf *.kde to delete everyone's .kde hidden directory in their home dir?

Depending on where you run that from, it's probably not going to match anything (or it won't match what you want it to).

Quote:

Originally Posted by Carlwill
I know if I remove KDE from server_old, that will not remove their ~/.kde directories sadly unless there is a switch I am unaware of.

IMO, that's a good thing. ;) I would be irked if removing (or upgrading) a DE decided to blow away personalized configurations.

Quote:

Originally Posted by Carlwill
Anyone know what the best course of action would be?

One option would be a simple find, e.g.:
Code:

# find /home -name '.kde' -exec echo rm -r {} \;
See that echo in there? Run the command once and make sure you're very certain it is only going to delete what you'd expect. Then run it again without the echo...

carlosinfl 06-09-2008 12:49 PM

Quote:

Originally Posted by anomie (Post 3179490)
One option would be a simple find, e.g.:
Code:

# find /home -name '.kde' -exec echo rm -r {} \;
See that echo in there? Run the command once and make sure you're very certain it is only going to delete what you'd expect. Then run it again without the echo...

I ran the following in the command prompt:

Code:

# find /home -name '.kde' -exec echo rm -r {} \;
It came back immediately with no results...did I do it wrong?

anomie 06-09-2008 12:57 PM

I don't want to be offensive here, but you didn't include the # in that command did you? ;) That's intended to be a root prompt.

carlosinfl 06-09-2008 01:08 PM

No offense taken and yes - its Monday so I am allowed to make one stupid mistake... :)


All times are GMT -5. The time now is 03:26 PM.