Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Bash Uploader For Letitbit
- # Version 2.0140617
- version="2.0140617";
- # /usr/local/bin/letitbitUploader.sh
- # Dependencies:
- # 1. plowshare script: https://code.google.com/p/plowshare/wiki/Contributions
- # Scope:
- # 1. Randomly scrambles the checksum hash values of all files in current directory
- # 2. Uploads all files in a directory to an account on Letitbit
- ####################################################################################################
- # CONFIGURATION SETTINGS #
- ####################################################################################################
- # Configure the following with your credentials between the ' ' marks.
- user='';
- pass='';
- ####################################################################################################
- # SCRIPT #
- ####################################################################################################
- echo "##################################################";
- echo "# Bash File Upload For Letitbit v"$version" #";
- echo "##################################################";
- ####################################################################################################
- green=$(tput setaf 2); yellow=$(tput setaf 3); red=$(tput setaf 1); cyan=$(tput setaf 6); textreset=$(tput sgr0); STARTTIME=$(date +%s);
- #Uploads the files
- rm -f .Letitbit.swp LetitbitLinks.txt 2>/dev/null; touch .Letitbit.swp 2>/dev/null;
- for file in ./*; do
- fileExtension=`ls $file | cut -c3-`;
- fileName=`ls $file | sed 's/\.\///'`;
- if [[ $fileExtension == *.txt ]] || [[ $fileExtension == *.png ]] || [[ $fileExtension == *.jpeg ]] || [[ $fileExtension == *.jpg ]]; then
- echo $yellow"Skipping:"${textreset};
- echo $yellow"$fileName"${textreset};
- echo $cyan"***************************************************************"${textreset};
- fi;
- if [[ $fileExtension != *.txt ]] && [[ $fileExtension != *.png ]] && [[ $fileExtension != *.jpeg ]] && [[ $fileExtension != *.jpg ]]; then
- echo $cyan"***************************************************************"${textreset};
- echo $yellow"Uploading "$fileName"..."${textreset};
- plowup -q -r 3 -a $user":"$pass Letitbit $file > .Letitbit.swp;
- uploadLink=`cat .Letitbit.swp | grep -v "^\#DEL\ " | tr -d '\n' | tr -d '\ ';`;
- uploadedFileSize=`ls -lh $file | awk {'print $5'}`;
- echo "[B]Letitbit: [/B][URL="$uploadLink"]"$fileName" - "$uploadedFileSize"B[/URL]" >> LetitbitLinks.txt
- echo $green$fileName" successfully uploaded!"${textreset};
- echo $green$uploadLink${textreset};
- rm .Letitbit.swp 2>/dev/null;
- fi;
- done;
- sed -i '/\[B\]Letitbit\:\ \[\/B\]\[URL\=\]/d' LetitbitLinks.txt;
- cat LetitbitLinks.txt
- #Counts the number of links generated and display with number of files in current directory.
- numFiles=`ls ./* | grep -v \.txt$ | grep -v \.png$ | grep -v \.jpg$ | grep -v \.jpeg$ | wc -l`;
- numLinks=`cat LetitbitLinks.txt | wc -l`; ENDTIME=$(date +%s);
- echo "Number of files in this directory: "$numFiles;
- echo "Total # Letitbit URLs generated: "$numLinks;
- echo "Number of seconds this script ran for: "$(($ENDTIME - $STARTTIME));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement