Skip to content

Instantly share code, notes, and snippets.

@henri
Created August 7, 2022 10:06
Show Gist options
  • Save henri/1c9e45c2810584690a387650323d70e4 to your computer and use it in GitHub Desktop.
Save henri/1c9e45c2810584690a387650323d70e4 to your computer and use it in GitHub Desktop.
Find Files By Time Of Creation
#!/usr/bin/env bash
# find files within folder with creation time falling between 6PM and 9AM (change as required).
for f in /myfolder/* ; do
var=$(date -r "$f" '+%H')
if [ $var -gt 18 ] || [ $var -lt 9 ] ; then
ls -l "$f"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment