- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to find file with mtime < 1 day
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
05-14-2002 05:54 PM
05-14-2002 05:54 PM
I want to know how to find or list files
with atime/mtime/ctime less than one day.
'Cause our application had created lots of logs yesterday , and I had to find out and mv to another dir ,
$ ls -l o329510.out
-rw-r--r-- 1 erpmgr dba 16848 May 14 13:54 o329510.out
$
$ find . -mtime +1 -print
$ ==> Nothing print cause mtime less than one day.
Somebody could tell me how to find or ls.
like :
find . -mtime ??? -exec mv /home/erpmgr/bak {}\;
ls -l | grep "May 14" | exec mv ???
Thanks in advance.
Violin.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2002 06:01 PM
05-14-2002 06:01 PM
Re: How to find file with mtime < 1 day
will find all files along path with mtime less than 24 hours.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2002 06:13 PM
05-14-2002 06:13 PM
Re: How to find file with mtime < 1 day
You should be able to use "-mtime 0" for your purpose.
# find . -mtime 0 -print
OR
You can create a reference file .. for example
# touch 05140001 ref
# find . -newer ref -print
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2002 06:13 PM
05-14-2002 06:13 PM
Re: How to find file with mtime < 1 day
BUT mtime 0 will list files created today.
Is there other option , maybe by X hours?
Violin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2002 06:19 PM
05-14-2002 06:19 PM
Re: How to find file with mtime < 1 day
You can use the -newer option with find by specifying to a file. Check the man pages for details.
HTH,
Shiju
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2002 06:19 PM
05-14-2002 06:19 PM
Re: How to find file with mtime < 1 day
Have a look at the -newer using the additional time value option.
# find -newer tv1 tv2 file
HTH
~Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2002 06:35 PM
05-14-2002 06:35 PM
Re: How to find file with mtime < 1 day
touch -t 05140001 /tmp/XX
find /dirA/subdirB -newer /tmp/XX | mv /newdir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2002 06:40 PM
05-14-2002 06:40 PM
Re: How to find file with mtime < 1 day
May14 13:54 filea
May14 13:55 fileb
May14 14:01 filec
May14 14:12 filed
Assuming all files are dated May14. Say you want to list all files created between 13:53 and 13:56, then you can do this ..
# cd /tmp
# touch 05141353 refa
# touch 05141356 refb
Now in that dir, you would run ..
# find . \( -newer /tmp/refa -a ! newer /tmp/refb \) -print
and that should just list "filea" and "fileb"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2002 06:55 PM
05-14-2002 06:55 PM
Re: How to find file with mtime < 1 day
BUT ERRORS:
$find . \( -newer /tmp/refa -a ! newer /tmp/refb \) -print
find: bad option newer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2002 06:57 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2002 07:09 PM
05-14-2002 07:09 PM
Re: How to find file with mtime < 1 day
It works, BUT another question:
Can I find and then mv to other directory?
find . \( -newer /tmp/refa -a ! -newer /tmp/refb \) -exec mv /bak {} \;
I tried and retunred error:
mv: ./o329545.out: rename: Not a directory
mv: ./o329547.out: rename: Not a directory
Thanks again.
Violin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2002 07:25 PM
05-14-2002 07:25 PM
Re: How to find file with mtime < 1 day
# find . \( -newer /tmp/refa -a ! -newer /tmp/refb \) -exec mv {} /bak \;
I'm glad it worked for you :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2002 07:27 PM
05-14-2002 07:27 PM