Skip to content

Instantly share code, notes, and snippets.

@jzbruno
Last active December 22, 2016 22:35
Show Gist options
  • Save jzbruno/0970a80d8b90f925875ebd82d02d86d7 to your computer and use it in GitHub Desktop.
Save jzbruno/0970a80d8b90f925875ebd82d02d86d7 to your computer and use it in GitHub Desktop.
Create a set of files begining with the date in YYYMMDD format
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
}
@jzbruno
Copy link
Author

jzbruno commented Dec 22, 2016

Specific to the OS X date command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment