- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- file cleanup
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
Forums
Discussions
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
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
12-04-2001 11:43 AM
12-04-2001 11:43 AM
How do I remove/delete files older than 1 hour or last modified was 1 hour ago?
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2001 11:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2001 11:58 AM
12-04-2001 11:58 AM
Re: file cleanup
I have a Perl utility fileage.pl which can tell if a file has been accessed, modified, or changed in a period of time.
Here is one approach:
cd to desired directory:
find . -type f -print | while read X
do
fileage.pl -m 3600 ${X}
STAT1=$?
fileage.pl -c 3600 ${X}
STAT2=$?
if [ ${STAT1} -eq 0 -a ${STAT2} -eq 0 ]
then
echo "File ${X} Has not been modified in \c"
echo "3600 seconds"
# rm -f ${X}"
fi
done
Fileage.pl returns 0 if the file has not been modified and 1 if it has. Simply invoke fileage.pl without arguments for full usage. Note: The rm is commented out. Test first.
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2001 11:59 AM
12-04-2001 11:59 AM
Re: file cleanup
linux has the find . -cmin n optio, hp does not, create a referention file every hour and,
find . -newer file -exec rm {}\;
Hope this will help,
Gideon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2001 12:04 PM
12-04-2001 12:04 PM
Re: file cleanup
should be:
rm -f ${X}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2001 12:05 PM
12-04-2001 12:05 PM
Re: file cleanup
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2001 12:10 PM
12-04-2001 12:10 PM
Re: file cleanup
BASEFILE=/tmp/dummyfile
HERE=/path/to/directory/to/start/from
now=`date +%m%d%H%M`
hourago=`expr $dt - 100`
touch -t $hourago $BASEFILE
cd $HERE
find . -type f ! -newer $BASEFILE -exec rm {} \;
(note that you can replace rm with ls to list the files rather than delete them)
good luck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2001 12:12 PM
12-04-2001 12:12 PM
Re: file cleanup
hourago=`expr $now - 100`