- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- list files on a certain date !
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
06-26-2007 02:22 PM
06-26-2007 02:22 PM
Please give me the command to:
1. List all fies generated in on file system on a certain date.
2. Count all fies generated in on file system on a certain date.
3. Calculate the total of space for all fies generated in on file system on a certain date.
thank a lot
Tung
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2007 02:33 PM
06-26-2007 02:33 PM
Re: list files on a certain date !
In order to find files modified on a certain date, use the touch command to create two reference files: /tmp/F1 - mtime = 1 second before the start of the target day and /tmp/F2 mtime = 1 second after the end of the target day. You then use the find command with -older and -newer options:
Something like this:
find / -type f \( -newer /tmp/F1 -a -older /tmp/F2 \) -exec ls -l {} \;
Man touch and find for details.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2007 02:44 PM
06-26-2007 02:44 PM
Re: list files on a certain date !
To display each file's creation date, last access date, and last modification date for the files stored, use the SHOW=DATES option.
For example:
:FILE T;DEV=TAPE
:STORE @.PUB.DOC;*T;SHOW=DATES
Refer following documnet for detail information:
http://docs.hp.com/en/32650-90484/ch06s03.html
Thanks & Regards
Reshma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2007 02:52 PM
06-26-2007 02:52 PM
Re: list files on a certain date !
In HP-unix we have access, modify time stamps..
1] touch --> update access, modification, and/or change times of file
syntax:
touch [-amc] [-r ref_file | -t time] file_name...
Refer below document:
http://docs.hp.com/en/B2355-60130/touch.1.html
2] find --> find files according to option given..
Here you can go for -atime, -mtime, -newer options to fulfil the requirements
Refer below document for options description:
http://docs.hp.com/en/B2355-60130/find.1.html
http://docs.hp.com/en/B2355-60130/findstr.1.html
Thanks & Regards
Reshma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2007 03:40 PM
06-26-2007 03:40 PM
Re: list files on a certain date !
Thank you for your quickly responses.
I think when a new file is created, the creation time is the same with modified time. So can we use -mtime in find command to list all file in a certain day. For example, I want to list all file generated on yesterday from one directory.
Can we use combination of find and grep for that purpose?
Reshma, sorry I dont understand much about SHOW parameter.
Thanks a lot
Tung
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2007 04:00 PM
06-26-2007 04:00 PM
Re: list files on a certain date !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2007 04:16 PM
06-26-2007 04:16 PM
Re: list files on a certain date !
That's for MPE/iX, not HP-UX. And you would want to send the tape output to $NULL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2007 04:43 PM
06-26-2007 04:43 PM
Re: list files on a certain date !
Every day, our Oracle database create a lot of archive files. So I just want to list out all files created by a certain day. For example, list all file created on 26-Jun-2007. And count them. And calculate the total space of them.
Sorry Reshma,
Our system is HPUX.
Thank you very much for your answers.
Tung
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2007 04:50 PM
06-26-2007 04:50 PM
Re: list files on a certain date !
If these files are created and never modified, then you can use -mtime.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2007 08:33 PM
06-26-2007 08:33 PM
Re: list files on a certain date !
Thanks a lot for your reply.
I tried as what you recomended:
# touch -amt 0706252359 temp1.touch
# touch -amt 0706270000 temp2.touch
#find . -type f \( -newer temp1.touch -a ! -newer temp2.touch \) -exec ll {} \;
The output display the list of files I needed but I dont know why it also display the temp2.touch file here.
Do you have any ideas about that?
Tung
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2007 09:03 PM
06-26-2007 09:03 PM
SolutionYou should use "{} +" instead, not "{} \;".
>but I dont know why it also display the temp2.touch file here.
Because the ! -newer test is >= not >. You are going to have to grep out that boundary value. This is elementary C++ STL programming.
So strictly speaking the second reference file must be in the time range you want and the first not.
touch -amt 0706262359 temp2.touch
This gets every file modified on June 26.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2007 09:27 PM
06-26-2007 09:27 PM
Re: list files on a certain date !
Thank you very much for your explain.
if we use:
touch -amt 0706262359 temp2.touch
Do we lost some files created from 0706262359.01 second to 07062359.59 second?
rgds,
Tung
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2007 10:45 PM
06-26-2007 10:45 PM
Re: list files on a certain date !
Sorry, you're right, both should be:
# touch -amt 0706252359.59 temp1.touch
# touch -amt 0706262359.59 temp2.touch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2007 01:56 PM
06-27-2007 01:56 PM
Re: list files on a certain date !
Thank you very much for your help.
I have another question, how can I calculate the total space of those files?
Regards,
Tung
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2007 02:23 PM
06-27-2007 02:23 PM
Re: list files on a certain date !
find .... -exec ls -l {} \; | awk '{tot += ($5 + 0)} END {printf("%10d\n",tot)}'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2007 04:10 PM
06-27-2007 04:10 PM
Re: list files on a certain date !
Thanks for your help.
When I try use "\;" for the find command as following:
find . -type f -newer temp1.touch -a ! -newer temp2.touch -exec ll {} \;
I got the result as my expect.
But if I use "\+" al following:
find . -type f -newer temp1.touch -a ! -newer temp2.touch -exec ll {} \+
nothing was display.
Another question, if I use this command: find . -type f -newer temp1.touch -a ! -newer temp2.touch -exec ls -lt {} \; the sort ("-t")not happend for the result.
Could you please explain me why?
Rgds
Tung
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2007 04:41 PM
06-27-2007 04:41 PM
Re: list files on a certain date !
Re-read dennis's reply... no \, just +
>> Another question, if I use this command: find . -type f -newer temp1.touch -a ! -newer temp2.touch -exec ls -lt {} \; the sort ("-t")not happend for the result.
It is happening... 1 file at a time.
You are asking ls -lt to operate on the file just found. The one file.
I would just feed the found files into an awk/perl/shel script to add up the details and display. For example:
$ find xx -newer begin ! -newer end | perl -ne 'print; chomp; $s+=-s}{print "$. files, $s bytes\n"'
$ find xx -newer begin ! -newer end | xx/a
xx/x.awk
xx/b
xx/aa
4 files, 1808 bytes
SMOP to change layout, report MB or GB.
Cheers,
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2007 05:15 PM
06-27-2007 05:15 PM
Re: list files on a certain date !
find . -type f -newer temp1.touch -a ! -newer temp2.touch -exec ll {} \+
nothing was display.
I can't explain that. It works fine for me, with "+" or with ";". I get the same number of files.
>the sort ("-t") not happend for the result.
Could you please explain me why?
Because you are not sorting ALL of the files at the same time. Even with +.
Since you are getting the results for just one day, you could just sort on the time field: sort -k8,8
>Hein: Re-read dennis's reply... no \, just +
That shouldn't make a difference but as a purest, you shouldn't have the backslash and I've asked that the man page be fixed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2007 07:23 PM
06-27-2007 07:23 PM
Re: list files on a certain date !
Thanks for your explain and your script.
Dear Mr.Dennis,
Thanks for your kindly help.
Please see the following:
[root@COVIS1:/tmp]find . -newer temp1.touch -a ! -newer temp2.touch -exec ll {} \;
-rw------- 1 root sys 10225 Jun 27 17:18 ./mana01910
total 0
srwxrwxrwx 1 cc tuxedo 0 Jun 27 22:05 agent.17125
srwxrwxrwx 1 cc tuxedo 0 Jun 27 22:05 ./ssh-iVPpd17125/agent.17125
-rw-r--r-- 1 root sys 0 Jun 27 23:59 ./temp2.touch
-rw------- 1 root sys 14889 Jun 27 17:18 ./cata01910
[root@COVIS1:/tmp]find . -newer temp1.touch -a ! -newer temp2.touch -exec ll {} +
[root@COVIS1:/tmp]find . -newer temp1.touch -a ! -newer temp2.touch -exec ls {} +
[root@COVIS1:/tmp]find . -newer temp1.touch -a ! -newer temp2.touch -exec ls -l {} +
./cata01910 ./mana01910 ./ssh-iVPpd17125/agent.17125 ./temp2.touch
./ssh-iVPpd17125:
agent.17125
As you see, when I use "-exec ll {} \;", it worked; but when I use "-exec ll {} +", nothing display in the result; when I use "-exec ls {} +", nothing display also; but when I use "-exec ls -l {} +", it worked.
I think there is a relationship between "ll /ls" command with "{} \;" or "{} +".
Is it right? Could you please explain for me.
Thanks again
Tung
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2007 07:41 PM
06-27-2007 07:41 PM
Re: list files on a certain date !
I see it but it doesn't happen for me.
>I think there is a relationship between "ll /ls" command with "{} \;" or "{} +".
Is it right? Could you please explain for me.
I don't see how but use this:
$ find . -type f -newer temp1.touch -a ! -newer temp2.touch \
-exec /usr/bin/ll +
Don't use \ before the + or {} and use an absolute path for ll and find only files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2007 09:54 PM
06-27-2007 09:54 PM
Re: list files on a certain date !
Thank you for your help.
I really confuse of using {} for -exec option of the find command. I dont know when can I use {} and when not. And how to use it with "+".
Could you please help me understanding it clearly.
Thanks and Best regards,
Tung
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2007 10:49 PM
06-27-2007 10:49 PM
Re: list files on a certain date !
Did the absolute path (for ll) help?
>I really confuse of using {} for -exec option of the find command. I dont know when can I use {} and when not. And how to use it with "+".
You don't need {} with + but Posix requires it.
And you need {} for ";".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2007 05:00 PM
06-28-2007 05:00 PM
Re: list files on a certain date !
Thank you for your help.
>Did removing the {} make it work? Yes
>Did the absolute path (for ll) help? No, no absolute path still worked.
Now I know how to solve this issues.
Thanks a lot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2007 05:27 PM
06-28-2007 05:27 PM
Re: list files on a certain date !
That's great. Please read the following about assigning points:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2007 07:35 PM
06-28-2007 07:35 PM
Re: list files on a certain date !
Tung