- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- list files created yesterday
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
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
тАО10-12-2004 06:55 PM
тАО10-12-2004 06:55 PM
I would like to ask how can i list files created yesterday using a single command line.
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-12-2004 07:04 PM
тАО10-12-2004 07:04 PM
Re: list files created yesterday
Check whether this helps you.
Today is Oct 13 so for yesterday i will do like this.
# ls -al | grep "Oct 12"
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-12-2004 07:07 PM
тАО10-12-2004 07:07 PM
Re: list files created yesterday
# ls -Ral | grep "Oct 12"
Hope that helps.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-12-2004 07:16 PM
тАО10-12-2004 07:16 PM
Re: list files created yesterday
find / -type f -name "*" -exec ls -al {} \; | grep 'Oct 12'
HTH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-12-2004 07:44 PM
тАО10-12-2004 07:44 PM
Re: list files created yesterday
thanks for your quick reply.
Am thinking of putting the date in variable.
Is that possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-12-2004 07:49 PM
тАО10-12-2004 07:49 PM
Re: list files created yesterday
It's possible.
# var1="Oct 12"
# ls -Ral | grep "$var1"
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-12-2004 07:53 PM
тАО10-12-2004 07:53 PM
Solutionif you need a scriptable solution where your "yesterday" is calculated automaticaly try this:
ls -la | grep "$(TZ=$(date +%Z)+24; date '+%b %e')"
I got the datecalculation from some other threads here. It is a common problem to calculate yesterdays date. Check for example this thread:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=541033
Hope this helps
Regards Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-12-2004 07:59 PM
тАО10-12-2004 07:59 PM
Re: list files created yesterday
unix does not store any information about the creation time of files. It does, however, store the time of the last change, the time of the last read, and the time of the last change of the inode of the file, but that is all.
You probably have to maintain a database of the creation time yourself - sorry.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-12-2004 08:00 PM
тАО10-12-2004 08:00 PM
Re: list files created yesterday
/tmp>touch -t $(date +%m%d)0000 ref_file
/tmp>find . -newer ref_file
.
./pdenq.log
./.oracle
./.oracle/s#7484.1
./export_test.log
./dhcpfifo.root
./dhcpfifo.any
./analyze.20041013.dev_dev.7701.log
./analyze.20041013.test_test.7700.log
Regards,
Fred
"Reality is just a point of view." (P. K. D.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-12-2004 11:40 PM
тАО10-12-2004 11:40 PM
Re: list files created yesterday
As observed, there is no creation time recorded as such, you'll have to pick between 'mtime' modification time (the one displayed by ls -l and 'ctime' attribute change time. The 'atime' (ls -ul) is probably not usefull as a simple grep jiggle that.
If 'yesterday' means 'withing the last 24 hours' then it becomes a trivial problem:
find . -mtime -1
Otherwise the suggestion above will help.
Hein.