- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Interrogate file owner
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2006 09:18 AM
02-20-2006 09:18 AM
Syntax used:
find . -depth -mtime +
-exec rm {} \;
This script works great to remove files that are certain days old, but I need to add to it to Not remove the file if it is owned by a paticular user. Any ideas on how to do this?
Monte
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2006 09:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2006 09:34 AM
02-20-2006 09:34 AM
Re: Interrogate file owner
will delete all files that have not been modified in the last 30 days and not owned by user "mickey".
When developing any finds like this, it is always better to -exec a safe command like "ls -l" until you are certain that your filters are just right and then switch to the real "rm" command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2006 01:20 AM
02-21-2006 01:20 AM
Re: Interrogate file owner
That was exactly the answer I was looking for. This forum is priceless!
Monte Heeren
DBA/Systems Engineer
Area Education Agency 11
Johnston IA 50131
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2006 03:48 AM
02-21-2006 03:48 AM
Re: Interrogate file owner
If I enter:
find . -user mickey -exec ll {} \;
it will return with only files that are
owned by mickey. This works great.
But if I enter:
find . ! -user mickey -exec ll {} \;
it returns with all the files in the dir,
including the files owned by mickey.
Look like the ! operator is not working.
Is there another "NOT" character to use?
Monte.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2006 03:56 AM
02-21-2006 03:56 AM
Re: Interrogate file owner
Are you using "csh"? If so, the ! character means something else. Try putting a backslash "\" in front of it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2006 03:58 AM
02-21-2006 03:58 AM
Re: Interrogate file owner
You didn't bother to indicate your HP-UX version but I would also make sure that the latest find cumulative patch is installed. For 11.11, it's PHCO_30746.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2006 04:00 AM
02-21-2006 04:00 AM
Re: Interrogate file owner
You need to make it boolean.
Surround the two operators with ( ) - separate them with spaces from the operands AND use -a for the AND operator.
HTH,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2006 04:01 AM
02-21-2006 04:01 AM
Re: Interrogate file owner
Try adding "-type f" to the command:
find . ! -user mickey -mtime +30 -type f
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2006 04:02 AM
02-21-2006 04:02 AM
Re: Interrogate file owner
# find . ! -user mickey -mtime +30 -type f -exec ll -d {} ;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2006 04:02 AM
02-21-2006 04:02 AM
Re: Interrogate file owner
You need to make it boolean.
Surround the two operators with ( ) - separate them with spaces from the operands AND use -a for the AND operator.
And they need to be escaped with leading \
HTH,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2006 04:16 AM
02-21-2006 04:16 AM
Re: Interrogate file owner
This is the only place for Unix help!
I added the -type f to the end of the command and it works perfectly.
Monte Heeren.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2006 04:20 AM
02-21-2006 04:20 AM
Re: Interrogate file owner
I have found the answer and am closing this thread.