LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   RM command (https://www.linuxquestions.org/questions/linux-newbie-8/rm-command-780871/)

networkingnub 01-08-2010 10:51 AM

RM command
 
Is there a way to do the rm command where I can remove files by owner.

I run the standard ls -al command and I want to be able to remove the files that are owned by me in that current directory.

One other step how can I remove files in all directories owned by me


Please and thanks I did the google search first guys and a majority of the pages just dealt with the basics like rm -r

What I have here is a little more specific....please and thanks.

kirukan 01-08-2010 11:16 AM

On current directory
#find . -group groupname -user username | xargs rm -f {}\;

In different directory
#find /path -group groupname -user username | xargs rm -f {}\;

Samotnik 01-08-2010 12:08 PM

You don't need to use {}\ with xargs.
Should be
find /path -group groupname -user username | xargs rm -f
or
find /path -group groupname -user username -exec rm -f '{}'\;

kirukan 01-11-2010 04:01 AM

Quote:

find /path -group test -user test -exec rm -f '{}'\;
I have received the following message...
Quote:

find: missing argument to `-exec'
whats wrong on the above mentioned command/

Samotnik 01-12-2010 06:21 PM

My fault :-(

Code:

find /path -group test -user test -exec rm -f '{}' \;
Space is significant.

pixellany 01-12-2010 06:43 PM

What space?? (I put the latest version in code tags for clarity)


All times are GMT -5. The time now is 11:04 PM.