Closed Thread
Results 1 to 5 of 5

Thread: List files by Date Range

  1. #1
    mop
    mop is offline Learning Programmer
    Join Date
    Apr 2008
    Posts
    30
    Rep Power
    0

    List files by Date Range

    I'm in a directory with hundreds of files and need to see between a certain date range. Is there a way to do this with ls -la?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Jordan Guest
    I don't know how to do a date range but you can list by date:

    Code:
    # ls - lt
    If you have a lot of files you can pipe that to more:
    Code:
    # ls -lt | more

  4. #3
    Tor
    Tor is offline Programming Expert
    Join Date
    Oct 2007
    Posts
    488
    Rep Power
    0
    You can use a script to do this:

    Code:
    #!/bin/bash
    for filename in *; do
       if [[ `date -r $filename +%Y` = $1 ]]; then
          echo $filename
       fi
    done
    Name it something and then pass it a date. IE: myscript.sh 10/13/2009

  5. #4
    mop
    mop is offline Learning Programmer
    Join Date
    Apr 2008
    Posts
    30
    Rep Power
    0
    Thanks Tor, I think that will work for me.

  6. #5
    Tor
    Tor is offline Programming Expert
    Join Date
    Oct 2007
    Posts
    488
    Rep Power
    0
    Anytime.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Simple batch date operation (backup files).
    By bbqroast in forum Computer Software/OS
    Replies: 3
    Last Post: 06-21-2011, 02:33 PM
  2. List files in a directory for C++
    By Groogy in forum C and C++
    Replies: 4
    Last Post: 08-01-2010, 09:57 PM
  3. A list of files recently saved by the user
    By kakarukeys in forum C and C++
    Replies: 11
    Last Post: 06-04-2009, 04:34 AM
  4. pulling a list of files in C#
    By Siten0308 in forum C# Programming
    Replies: 7
    Last Post: 07-31-2008, 09:33 AM
  5. List all files used at the moment.
    By sakishrist in forum Visual Basic Programming
    Replies: 28
    Last Post: 05-21-2008, 01:34 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts