Last active
December 22, 2016 22:35
-
-
Save jzbruno/0970a80d8b90f925875ebd82d02d86d7 to your computer and use it in GitHub Desktop.
Create a set of files begining with the date in YYYMMDD format
This file contains hidden or 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
create_files_with_dates () { | |
file_name=$1 | |
num_days=$2 | |
tmp_dir="tmp/" | |
mkdir -p $tmp_dir | |
for ((i=0; i <= $1 - 1; i++)); do | |
day=`date -j -v-${i}d +%Y%m%d` | |
> ${tmp_dir}${day}${file_name} | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Specific to the OS X date command.