Created
May 9, 2014 09:24
-
-
Save unfo/4de8c3d28c3093b908f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Author: @unfo | |
# | |
# Prints files for a given relative day | |
# | |
# 0 = today # this is also the default | |
# -1 = yesterday | |
# -2 = day before yesterday | |
DAY_1=0 | |
if [ $# -eq 1 ]; then | |
DAY_1=$1 | |
fi | |
DAY_2=$(($DAY_1 + 1)) | |
dtm_1=$(date -d "$DAY_1 day" +%Y-%m-%d) | |
dtm_2=$(date -d "$DAY_2 day" +%Y-%m-%d) | |
find . -type f -newermt $dtm_1 ! -newermt $dtm_2 | |
# Example: | |
# Prints all files from a week ago | |
# dayls.sh -7 | xargs ls -lth |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment