Find the answer to your Linux question:
Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Banned
    Join Date
    Dec 2002
    Location
    Texas
    Posts
    242

    Find all files modified in a date range


    I normally use "find /path -mtime x" when looking for files
    modified in various 24 hours periods in the past. But what
    if I'm wanting to find all files between date X and Y though?
    Let's say, for example, all files modified in 2006... what's the
    most logical way to script getting a list of those files?

  2. #2
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Slackware, {Free, Open, Net}BSD, Solaris
    Posts
    1,465
    Hi.

    There's an example for that task in the page below ... cheers, drl

    http://amitsharma.linuxbloggers.com/how_to_find.htm
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  3. #3
    Banned
    Join Date
    Dec 2002
    Location
    Texas
    Posts
    242
    touch temp -t 200604141130
    touch ntemp -t 200604261630
    find /data/ -cnewer temp -and ! -cnewer ntemp

    Excellent! I would never have come upon that.

    Thanks!

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Slackware, {Free, Open, Net}BSD, Solaris
    Posts
    1,465
    Hi.

    Yes, it's creative. He has a lot of good information on that page ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  6. #5
    try this
    Code:
      find . -mtime +$end -mtime -$start

  7. #6

    finding files by date

    # touch -t 200901010000.01 first
    # touch -t 200912312359.59 last
    find /var/ftp/pub/inspection_pics/ -type f -name '*.jpg' -newer first ! -newer last -exec ls -s {} \; -print > output.txt

Posting Permissions

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