Skip to content

Instantly share code, notes, and snippets.

@astail
Last active August 31, 2015 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astail/247df06105480ec68aba to your computer and use it in GitHub Desktop.
Save astail/247df06105480ec68aba to your computer and use it in GitHub Desktop.
#!/bin/sh
set -eu
root=/hdd2/owncloud/astel/files/tv
date=`date --date 'yesterday' +'%Y%m'`
if [ ! -e $date ]; then
mkdir $root/$date
fi
files="$root/$date*mp4"
for filepath in $files
do
if [ "$files" = "$filepath" ]; then
echo not files
else
echo move files
mv $filepath $root/$date/
fi
done
echo end
#cron
#30 23 1 * * /opt/move_dir.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment