- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Need the list of files which created in specific t...
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
04-16-2008 12:49 AM
04-16-2008 12:49 AM
I need the list of files which created in specific time.
Foe example: I need list of files in perticular directory which are created in last 1 hour.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2008 01:18 AM
04-16-2008 01:18 AM
Re: Need the list of files which created in specific time
To do this, you would have to use touch to create a reference file of exactly one hour ago, then use "find . -newer ref-file".
- Tags:
- find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2008 04:09 AM
04-16-2008 04:09 AM
Re: Need the list of files which created in specific time
With Perl, this is easy:
# perl -MFile::Find -le 'find(sub{print $File::Find::name if -f $_ && -M _ <= 1/24},@ARGV)' /path
THis will search the directory or directories passed as the script argument looking for FILES that were *modified* during the last hour (1/24 of a day).
By the way, there is no such thing as a creatino timestamp in Unix. The 'mtime' or last modification timestamp is equivalent to a creation moment when a file is first instantiated. Thereafter, any change in the file's contents updates the 'mtime' in its inode.
Regards!
...JRF...
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2008 05:04 AM
04-16-2008 05:04 AM
Re: Need the list of files which created in specific time
Was there something more that you wanted in your solution?
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2008 06:11 AM
04-16-2008 06:11 AM
Re: Need the list of files which created in specific time
I tried your command and it doesn't work for me. I tried both relative and absolute path.
Does this have to be run in a script or is it good to run at the prompt?
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2008 06:26 AM
04-16-2008 06:26 AM
Re: Need the list of files which created in specific time
It returns nothing on HPUX 11.11
on my 11.23 (recently patched) system
it does
# /usr/bin/perl -MFile::Find -le 'find(sub{print $File::Find::name if -f $_ && -M _ <:q= 1/24},@ARGV)' /tmp
syntax error at -e line 1, near "<:"
Can't find string terminator "=" anywhere before EOF at -e line 1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2008 06:28 AM
04-16-2008 06:28 AM
Re: Need the list of files which created in specific time
doesn work on hpux 11.11
on my 11.23 system it does th is
# /usr/bin/perl -MFile::Find -le 'find(sub{print $File::Find::name if -f $_ && -M _ <:q= 1/24},@ARGV)' /tmp
syntax error at -e line 1, near "<:"
Can't find string terminator "=" anywhere before EOF at -e line 1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2008 06:36 AM
04-16-2008 06:36 AM
Re: Need the list of files which created in specific time
Thanks for ur reply
I have 11.11 version of HP-Ux. So will it run on the same?
And can I add this line in may script?
Another one is , Is there any cmd shows the files modified in last one hour in perticular directory
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2008 06:50 AM
04-16-2008 06:50 AM
Solution> Vasu: I have 11.11 version of HP-Ux. So will it run on the same?
Yes, Perl should have been part of your 11i installation and hence my script will run.
> Vasu: Is there any cmd shows the files modified in last one hour in perticular directory?
Yes, this is the original script I posted for you. Simply pass the name of the directory you want to examine as the argument to the script. In the example I showd, I used '/path' as a generic argument label. You could use '/home' or '/home/vasu' or anything that is a directory.
> O'Kevin: Copy-and-paste my post and provide the directory or directories you are interested in examining as arguments. The absence of any output means that there were no files meeting the criteria.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2008 08:29 AM
04-16-2008 08:29 AM
Re: Need the list of files which created in specific time
I got following error on my system
Can't locate File/Find.pm in @INC (@INC contains: /opt/perl5/lib/5.00502/PA-RISC1.1 /opt/perl5/lib/5.00502 /opt/perl5/lib/site_perl/5.005/PA-RISC1.1 /opt/perl5/lib/site_perl/5.005 .).
BEGIN failed--compilation aborted.
Please provide solution
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2008 08:42 AM
04-16-2008 08:42 AM
Re: Need the list of files which created in specific time
> I got following error on my system
Can't locate File/Find.pm in @INC (@INC contains: /opt/perl5/lib/5.00502/PA-RISC1.1 /opt/perl5/lib/5.00502 /opt/perl5/lib/site_perl/5.005/PA-
You have a very old Perl on your server. The 'File::Find' module wasn't part of the Perl Core distribution at that time.
I suggest that you download and install a current Perl. No reboot is necessary!
http://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=PERL
...and if per chance this is an old 10.20 system, Merijn has a Perl for that:
http://mirrors.develooper.com/hpux/downloads.html
Perl 5.8.8 is an excellent version for production. Perl 5.10 was recently released too.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2008 06:44 AM
04-25-2008 06:44 AM
Re: Need the list of files which created in specific time
touch -t CCYYMMDDhhmm.SS /tmp/ref_file
run a find:
find start_dir -type f -newer /tmp/ref_file
as per "man find":
-newer file True if the current file has been modified more recently than the argument file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2008 06:54 AM
04-25-2008 06:54 AM
Re: Need the list of files which created in specific time
Why resurrect a 10-day old thread that has a bunny and for which your alternate proposal was first suggested by someone else on the opening day?
While 'find -newer ...' certainly works, it doesn't provide the moving window of time yielded by the Perl snippet I showed. Of course, you could wrap a 'touch' and a 'find' in a small shell script that creates the reference point; performs the 'find' and then removes the (then) useless reference file.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2008 02:28 AM
04-28-2008 02:28 AM