Created
January 27, 2012 00:58
-
-
Save offbeatadam/1686242 to your computer and use it in GitHub Desktop.
Bash Printf Annoying
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 | |
ROOTDIR="/home/triton/.irssi" | |
LOGDIR="$ROOTDIR/logs" | |
ARCHIVE="$ROOTDIR/logs.old" | |
printf "Beginning log archiving\n" | |
printf "Moving to log directory %s\n" "$LOGDIR" | |
cd $LOGDIR | |
for i in `ls -A` | |
do | |
printf "Moving to log subdirectory %s\n" "$i" | |
cd $LOGDIR/$i | |
for j in `ls -A` | |
do | |
printf "Current Working Directory: %s/%s/%s\n" "$LOGDIR" "$i" "$j" | |
cd $LOGDIR/$i/$j | |
for k in `find . -type f -atime +7` | |
do | |
printf "Archiving File %s/%s/%s/%s to %s/%s/%s/%s" "$LOGDIR" "$i" $j" "$k" "$ARCHIVE" "$i" $j" "$k" | |
cd $LOGDIR; | |
done | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment