Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- file=./tmp
- fileThreshold=10
- if [ ! -e "$file" ]; then
- echo "No such directory exists, directory has just been created"
- mkdir $file
- else
- echo "Directory exists"
- fi
- echo "Changing directory to $file"
- cd $file
- fileCount=`ls -l . | egrep -c '^-'`
- echo "$fileCount files found within $file"
- if [ "$fileCount" -gt "$fileThreshold" ]; then
- cd ../
- echo "changing directory to parent of $file"
- tar -zcvf files.tar.gz $file
- echo "Create ${file} archive"
- cd $file
- rm -rf *
- cd ../
- echo "Files collected"
- else
- echo "Not enough files to require archive"
- fi
- echo "Done."
- exit 1
- loopCounter=0
- while [ "$loopCounter" -lt "11" ]; do
- loopCounter=$((loopCounter + 1))
- fileName=`date +%s`
- touch $fileName
- echo $fileName
- sleep 1
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement