- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script
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
тАО09-19-2006 12:30 PM
тАО09-19-2006 12:30 PM
Please help
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-19-2006 01:45 PM
тАО09-19-2006 01:45 PM
Re: Script
find . -type +d -xdev -exec ls -ld {} \;
there is no command to search 4hours old file, you will need to write a script to see if file is 4hours old or no. Compare time stamps.. etc
Regards
Prashant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-19-2006 02:53 PM
тАО09-19-2006 02:53 PM
Re: Script
The following script will work provided that it's executed at or after 04:00:
#!/usr/bin/sh
touch -t $(date +%m%d$(expr $(date +%H) - 4)%M) /tmp/ref.${$}
find /dir -type f ! -newer /tmp/ref.${$} -exec rm -f {} \;
rm -f /tmp/ref.${$}
exit
If this restriction is unacceptable, use Clay's Date Hammer script to generate the reference file.
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-19-2006 03:00 PM
тАО09-19-2006 03:00 PM
Re: Script
touch -t 200609200052 timeREF
To find any files newer than timeREF:
find . -newer timeREF -type f -exec ls -ld {} \;
Change -type f to -type d to find directories.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-19-2006 11:37 PM
тАО09-19-2006 11:37 PM
Solution#!/usr/bin/sh
NOW_m_d=$(date +%m%d)
NOW_H=$(date +%H)
NOW_M=$(date +%M)
THEN_H=$(( ${NOW_H}-4 ))
if [[ ${THEN_H} -lt 10 ]]
then
THEN_Z=0
fi
touch -t ${NOW_m_d}${THEN_Z}${THEN_H}${NOW_M} /tmp/ref.${$}
find /dir -type f ! -newer /tmp/ref.${$} -exec rm -f {} \;
rm -f /tmp/ref.${$}
exit
I've also attached A. Clay's Date Hammer script to this posting.
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-20-2006 01:14 AM
тАО09-20-2006 01:14 AM
Re: Script
change the date 4Hr back of current time in above format.
To find files created before that date, use the cnewer and negation conditions:
$ find . \! -cnewer date_marker
Make a list and be confirming it├в s fulfilling your expectation. Then you may proceed to delete those.
Thanks!