This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes Datewise File search Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Datewise File search" Watch "Datewise File search" New topic
Author

Datewise File search

SaurabhSri Sri
Ranch Hand

Joined: May 01, 2008
Posts: 43
Hi All,

I hae a need of a Unix shell script which prompt me to input "From" and "To" date (dd/mm/yyyy) format. When I press enter it should print all the file names modified between given dates. e.g.
Consider following list of files in a particular directory –

File Name Date Modified (dd/mm/yyyy)

a.txt 12/01/2009
b.txt 11/01/2009
c.txt 10/01/2009
d.txt 09/01/2009
e.txt 08/01/2009
f.txt 07/01/2009
g.txt 06/01/2009
h.txt 05/01/2009

If I input From date = 06/01/2009 And To date = 09/01/2009, Then output should be -

g.txt
f.txt
e.txt
d.txt

Thanks a lot For any help.

Regards
SaurabhSri (SCJP 1.5)
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Please note that Java Ranch is not a code mill. Have you written anything so far? If so, what do you have working and what isn't working? Then someone might step up and help you get the broken part working.


JBoss In Action
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4646
    
    5

In Unix/Linux, one generally would not write code to do this, as the 'find' command does it with zero programming.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Type 'man find' for information on how the 'find' command works.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
 
subject: Datewise File search
 
Similar Threads
Problem getting correct date format
Capture month and year from user input date
Date Confusion
Capture month and year from user input date
Capture month and year from user input date