- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: files listing for specific time range
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
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
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
07-14-2016 11:40 PM
07-14-2016 11:40 PM
How to get listing of files which has been created on specific date I.e. I want the list of files created on 1st of july 2016
Solved! Go to Solution.
- Tags:
- find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2016 09:34 AM
07-15-2016 09:34 AM
Re: files listing for specific date
A forum or Web search for keywords like:
find newer touch
should find many examples of using "touch" to create files with the
date-time boundries, and then "find -newer" to do the search.
man touch
man find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2016 09:12 PM - edited 07-16-2016 09:12 PM
07-16-2016 09:12 PM - edited 07-16-2016 09:12 PM
Re: files listing for specific time range
>How to get listing of files which has been created on specific date range
Note: You can't get "created" only modified or accessed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2016 09:58 PM
07-17-2016 09:58 PM
Re: files listing for specific time range
Thanks Dennis,
Let me know the command to get modified or accessed files on 1st of July.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2016 02:38 AM
07-18-2016 02:38 AM
Re: files listing for specific time range
>Let me know the command to get modified or accessed files on 1st of July.
As Steven said, you need to search:
http://community.hpe.com/t5/Languages-and-Scripting/Script-to-get-quot-last-month-quot/m-p/5017836
http://community.hpe.com/t5/Languages-and-Scripting/help-newer-option-in-find/m-p/5122333
http://community.hpe.com/t5/System-Administration/find-mtime-newer/m-p/4875192
http://community.hpe.com/t5/Languages-and-Scripting/delete-the-files-with-date-wise/m-p/6391751
http://community.hpe.com/t5/Languages-and-Scripting/script-to-move-files-by-month/m-p/3968863
Use "touch -a -m" to set both access and modification times.
If you want both accessed OR modified in a date range you need an OR:
find ... \( -newer start -o -newera start \) \(! -newer stop -o ! -newera stop \)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2016 09:27 PM - edited 07-19-2016 09:30 PM
07-19-2016 09:27 PM - edited 07-19-2016 09:30 PM
SolutionThere is no single command to accomplish what you want. You must create 2 files with the timestamp range you need, in this case, July 1st. Then you construct a find command that looks for files newer than the start file and older than the stop file. Here are the steps:
touch -t 07010000 /tmp/jul1_start touch -t 07012359 /tmp/jul1_stop find /somedir -newer /tmp/jul1_start ! -newer /tmp/jul1_stop -type f -exec ls -l {} \;
So some details:
The touch command will create a new file or change the timestamp of an existing file.The man page for touch defines several forms of the date but the minimum form is MMDDhhmm (8 numbers). So the two reference dates are both 0701 (July 1st). One technical note is that a file created on Jul 1st at 00:00 will *not* be found. Only Jul 1st 00:01 will be newer than 070000. So for an exact selection, use:
touch -t 06305959 /tmp/jul1_start
Now, a file with a Jul 1st 00:00 timestamp will be found.
The second file is fine using 07012359 because "not newer" (the ! -newer construct) will be true if the file is Jul 1st 23:59.
I put the reference files in a specific location so that temp files don't get scattered in random locations.
The -type f is important because you said the requirement is for a file and not directories or symlinks, etc. This will prevent finding both directories and files.
The -exec is used only for testing. It will run the command ls -l on the results of the find. You can remove it to show just the filenames.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2016 04:37 AM
07-20-2016 04:37 AM
Re: files listing for specific time range
Hi Bill,
Thank you very much for your reply, its really very helpful to me and really appreciate regarding your step by step guidelines which really help me to find out the solution of my issue after long time.
Regards,
Nilesh