Skip to content

Instantly share code, notes, and snippets.

@vladpurga
Last active September 6, 2019 06:57
Show Gist options
  • Select an option

  • Save vladpurga/bd1c92004ea5c67da18b2509a9e22487 to your computer and use it in GitHub Desktop.

Select an option

Save vladpurga/bd1c92004ea5c67da18b2509a9e22487 to your computer and use it in GitHub Desktop.

Revisions

  1. vladpurga revised this gist Sep 6, 2019. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion find-mtime-24h-ago.sh
    Original file line number Diff line number Diff line change
    @@ -7,4 +7,7 @@ touch -d '-1 day' /tmp/test_day/yesterday
    touch /tmp/test_day/today

    # find directories with modification time older then 24 hours
    find /tmp/test_day -mindepth 1 -mtime +0 /tmp/test_day
    find /tmp/test_day -mindepth 1 -mtime +0

    # -and -a -or -o
    find /tmp/test_day -mindepth 1 -mtime -4 -a -mtime +1
  2. vladpurga created this gist Sep 5, 2019.
    10 changes: 10 additions & 0 deletions find-mtime-24h-ago.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    # create directories
    mkdir -p /tmp/test_day && cd $_ && mkdir -p today yesterday before_yesterday && cd -

    # in linux change modification time
    touch -d '-2 days' /tmp/test_day/before_yesterday
    touch -d '-1 day' /tmp/test_day/yesterday
    touch /tmp/test_day/today

    # find directories with modification time older then 24 hours
    find /tmp/test_day -mindepth 1 -mtime +0 /tmp/test_day