Last active
August 31, 2015 06:39
-
-
Save astail/247df06105480ec68aba 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/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