FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 10-26-2010, 09:29 PM
Max Hetrick
 
Default RM Help

On 10/26/2010 05:23 PM, Matt wrote:
> Is there a way to tell rm -f to only remove a file if its owned by say mail?

Not sure you can directly use rm for that, but you could find the uid of
the user in /etc/passwd, then run find and -exec on it with rm.

To view them:

cat /etc/passwd | grep "USER"

find /path -uid 123 -exec ls -la {} ;

To delete them, then use -exec rm -rf {} ;

Be CAREFUL though!

Regards,
Max
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-26-2010, 09:30 PM
 
Default RM Help

Matt wrote:
> Is there a way to tell rm -f to only remove a file if its owned by say
> mail?

find <path> -user mail -exec rm -f {} ;

man find.

mark

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-26-2010, 09:31 PM
R P Herrold
 
Default RM Help

On Tue, 26 Oct 2010, Matt wrote:

> Is there a way to tell rm -f to only remove a file if its owned by say mail?

find . -user "$USERMATCH"-name "$FILENAME"
-a -exec rm -f {} ;

or such ...

-- Russ herrold
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-26-2010, 09:34 PM
Markus Falb
 
Default RM Help

On 26.10.10 23:23, Matt wrote:
> Is there a way to tell rm -f to only remove a file if its owned by say mail?
>
> Matt

maybe something like this (untested)
#$ find /path -type f -a -user mail -exec rm {} ;

--
Best Regards,
Markus Falb

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 07:00 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org