- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Using rm on file with certain date/timestamp
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
Discussions
Discussions
Discussions
Forums
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
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
тАО08-09-2000 01:11 AM
тАО08-09-2000 01:11 AM
Using rm on file with certain date/timestamp
Can anyone give me a hand here ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-09-2000 01:22 AM
тАО08-09-2000 01:22 AM
Re: Using rm on file with certain date/timestamp
i think the best is to use find:
Example:
Find all files that arte older than one week and remove them:
find
help for your wish:
ll *ARC |grep 'Aug 2'|awk '{system("rm -f " $NF);}'
Cheers
Andrew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-09-2000 01:34 AM
тАО08-09-2000 01:34 AM
Re: Using rm on file with certain date/timestamp
Either use the -mtime argument to select files a number of days old or you could use the timestamp of an existing file and use the -newerm
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-09-2000 02:10 AM
тАО08-09-2000 02:10 AM
Re: Using rm on file with certain date/timestamp
If you choose John's method, you can always make a reference file by touch(ing) it with the timestamp you choose, as for example:
# touch -m -t 08090606 /tmp/f
which would create a file dated August 9, 2000 at 06:06.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-09-2000 04:33 AM
тАО08-09-2000 04:33 AM
Re: Using rm on file with certain date/timestamp
BTW why do you remove the archive files manually ?
If you have OmniBack you can backup the files and remove them within the OmniBack backup specification, ie. Oracle 8:
rman script:
....
"archivelog all delete input"
";"
.....
Regards
Andrew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-09-2000 05:28 AM
тАО08-09-2000 05:28 AM
Re: Using rm on file with certain date/timestamp
Directory of logfiles is: /logdisk01/oradata/arch/C2P#. The old files have a .ARC extension.
Example listing:
rw-r----- 1 oracle users 52429824 Aug 9 15:01 T0001S0000012927.ARC
-rw-r----- 1 oracle users 52429824 Aug 9 15:05 T0001S0000012928.ARC
-rw-r----- 1 oracle users 52429824 Aug 9 15:11 T0001S0000012929.ARC
I go there with cd and do a find . -name *ARC and get nothing.
If I do a find ./ -name T* I get:
find: missing conjunction.
What am I missing here ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-09-2000 05:38 AM
тАО08-09-2000 05:38 AM
Re: Using rm on file with certain date/timestamp
if you are using metachars like * within find you have to quote this:
find ./ -name 'T*'
Regards
Andrew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-09-2000 09:13 AM
тАО08-09-2000 09:13 AM
Re: Using rm on file with certain date/timestamp
E.g find . -name T!*
(read the backslash character for ! above).
Regards,
John
\ \
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-10-2000 01:33 AM
тАО08-10-2000 01:33 AM
Re: Using rm on file with certain date/timestamp
If you wish to use ll, then in order to get rid of whats before the filename you will have to use cmd cut:
# rm $(ll | grep " Aug 2" | cut -c 58-80)
But remember, in this the spaces of what is in between your doublequotes are important:
"Aug 2" vs " Aug 2 " (2 spaces between b & 2)
Hope this helps
Greetings
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-10-2000 05:04 AM
тАО08-10-2000 05:04 AM
Re: Using rm on file with certain date/timestamp
Andreas approach using ll|grep|awk does not appear to work if the 'rm' command is specified with any option, like '-f'. Using a simple 'rm' in the command string will work, however. This, at least, on 10.20.
If you prefer to use the more standard (less creative!) approachs, do:
# cd /ora_arch #...or whatever for you...
# find *.ARC -mtime +7 -exec rm -f {} \;
-or-
# cd /ora_arch
# touch -m -t 08030000 f.$$
# find *.ARC -newer f.$$ -exec rm -f {} ;
# rm f.$$
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-10-2000 06:20 AM
тАО08-10-2000 06:20 AM
Re: Using rm on file with certain date/timestamp
OOPS. Look carefully at Andreas' example. The "rm -f " syntax works perfectly fine if you put a BLANK after the 'f' and before the quote (OBVIOUSLY!!!). My apologies for any confusion.
...JRF...