LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-21-2006, 12:22 AM   #1
mahabooba
Member
 
Registered: Dec 2005
Posts: 43

Rep: Reputation: 15
To find the files


Hi,
How to find the files in particular directory between two specified dates using shell script?

Please help me in this regard.

Thanks and Regards,
Ali
 
Old 12-21-2006, 12:39 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

You could use the find command to get the wanted files. Something like the following get files that are between 5 and 10 days old:

find . -mtime -10 -mtime +5

See man find for details.

Hope this helps.
 
Old 12-21-2006, 09:13 AM   #3
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 735

Rep: Reputation: 76
Hi.

And there are numerous examples of the use of find at: http://amitsharma.linuxbloggers.com/how_to_find.htm ... cheers, makyo
 
Old 12-21-2006, 10:54 PM   #4
mahabooba
Member
 
Registered: Dec 2005
Posts: 43

Original Poster
Rep: Reputation: 15
Thanks you to all.

By http://amitsharma.linuxbloggers.com/how_to_find.htm URL I got the exact solution.


Question:
How about finding all the files that were created between two dates/times - for instance, find all files created between Apr 14 11:30 and Apr 26 16:30?

here's the solution for your query..
--------------------
find /data/ -cnewer temp -and ! -cnewer ntemp

prior to that..
touch temp -t 200604141130
touch ntemp -t 200604261630

Make sure you are in /data directory while running those touch commands otherwise you have to specify their complete path while running the find command.

Regards,
Ali
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find/grep command to find matching files, print filename, then print matching content stefanlasiewski Programming 9 06-30-2016 05:30 PM
linux find to find files with multiple patterns subu_s Programming 6 12-15-2010 12:15 AM
linux 'find' to find text files subu_s Programming 2 12-02-2004 02:56 AM
Cant find files KillerCheeto Linux - Software 1 05-25-2004 12:55 AM
find out which files are in use saavik Linux - Networking 2 12-19-2002 03:42 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration