- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Removing files dated in the future.
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-22-2002 05:16 AM
02-22-2002 05:16 AM
Hope someone can help me here, I'd be very grateful!
We have some files, quite a lot I'd guess, that have a date & time stamp in the future. This is because the Unix date has been changed back & forth on the box for User Acceptance Testing. These files are now causing a problem & I've been asked to remove everything that is time stamped with a future date.
Can someone possibly give me an idea how best to go about it, we know the directories they will be in & I'm guessing that find, grep or awk may do the trick. however I'm not too sure of the right syntax.
Many thanks in anticipation
Sue
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2002 05:24 AM
02-22-2002 05:24 AM
SolutionUse find with the -newer option.
Touch a reference file, perhaps /tmp/reference. It will be created with the current date/time.
find /dir -newer /tmp/reference -exec rm {} \;
I'd use -exec ll -d {} \;
before I actually ran with the rm just to be safe.
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2002 05:29 AM
02-22-2002 05:29 AM
Re: Removing files dated in the future.
#touch -t 03011212 XX #Just creating an example file to find later
#touch -t 02281212 ref
#find . -newer ref
./XX
Of course you could remove them with the find command:
#find . -newer ref -exec rm {} \;
Hope this helps,
Trond
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2002 05:29 AM
02-22-2002 05:29 AM
Re: Removing files dated in the future.
you could use the find- command with -newer to solve your problem:
find /path_to_directory -newer /path_to_time_reference_file -exec rm {}\;
if the number of files is not to big or if you want to make sure not to delete wrong files, you could also use -ok instead of -exec. This would mean you have to answer a confirming question with "y" to remove the file.
Allways stay on the bright side of life!
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2002 05:35 AM
02-22-2002 05:35 AM
Re: Removing files dated in the future.
I'm actually away from my system today, & am just preparing for tomorrow, so I'll give your suggestions a try then & assign points after.
Many thanks once again
Sue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2002 06:06 AM
02-23-2002 06:06 AM
Re: Removing files dated in the future.
The job got pulled in the end, so I didn't have to do it. However I tried out your suggestions on a test box & they all worked perfectly. Great reference for later.
Points assigned
Thanks for all youe assistance.
Sue