• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Datewise File search

 
SaurabhSri Sri
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15216
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Type 'man find' for information on how the 'find' command works.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic