Getting all files which have changed in specific time range

后端 未结 1 1826
孤城傲影
孤城傲影 2021-01-24 15:33

A very basic question in Bash but I can\'t seem to figure it out. I\'m looking for a one liner command with pipe, in bash which finds in the current directory all the *.py files

相关标签:
1条回答
  • 2021-01-24 16:06

    Use find:

    find . -maxdepth 1 -type f -name '*.py' -newermt "13:14:59.999" \! -newermt "13:30"
    

    Remove 1 millisecond from the lower bound time 13:15 so it includes 13:15:00 modification time.

    find parameters breakdown:

    • .: current directory
    • -maxdepth 1: do not descend sub-directories
    • -type f: real files (no links or directories or pipes or devices...)
    • -name '*.py': whose names match the pattern *.py
    • -newermt "13:14:59.999": whose modification time is after 13:14:59.999
    • \! -newermt "13:30": and whose modification time is not after 13:30
    0 讨论(0)
提交回复
热议问题