[linux]Rar files, upload to RS & HF then delete the files

Status
Not open for further replies.

Snell

Active Member
625
2009
18
240
download RS api and put it into the same folder as the following script.
http://images.rapidshare.com/software/rsapiresume.pl

Copy this shell script into a file and save as anything.sh

Changes to be made throughout the whole script
your-site.com >> your hostname
rsUserName >> your rapidshare username
rsPassword >> your rapidshare password
hfUserName >> your Hotfile username
hfPassword >> your Hotfile password

If you have premium rapidshare accounts, then change

col >> prem

PHP:
#!/bin/bash
if [ $# -ne 2 ]
then
  size=$((100 * 1024))
else
  size=$(($2 * 1024))
fi
  file=$1
  rarfile=${file%.*}_your-site.com.${file##*.}.rar
  rar a -m0 -v"$size"k $rarfile $1
  echo $rarfile >> rarNupload.log

if [ $2 ]; then
part=1
while [ $part -le 10 ]
do
    if [ -f ${file%.*}_your-site.com.${file##*.}.part$part.rar ];
    then
       echo "Uploading" ${file%.*}_your-site.com.${file##*.}.part$part.rar "to RS"
        perl rsapiresume.pl ${file%.*}_your-site.com.${file##*.}.part$part.rar col rsUserName rsPassword
       echo "Uploading" ${file%.*}_your-site.com.${file##*.}.part$part.rar "to HF"
        curl -T ${file%.*}_your-site.com.${file##*.}.part$part.rar ftp.hotfile.com --user hfUserName:hfpassword
        rm ${file%.*}_your-site.com.${file##*.}.part$part.rar
    else
       echo "File $FILE does not exists"
    fi
part=`expr $part + 1`
done
else
  echo "Uploading" $rarfile "to RS"
    perl rsapiresume.pl $rarfile col rsUserName rsPassword
  echo "Uploading" $rarfile "to HF"
    curl -T $rarfile ftp.hotfile.com --user HFUsername:hfpassword
  rm $rarfile
fi

This script is based on:
http://www.wjunction.com/showthread.php?t=25036
http://www.wjunction.com/showthread.php?t=32893

so a special thanks to desiboy & Avek <3
 
8 comments
forgot to add the usage:

./script.sh <file to be compressed> <Number of MB>

<Number of MB> if you want to split the files into several parts.

~~~~~~

increasing 10 to another number if you plan to use more than 10 parts

PHP:
while [ $part -le 10 ]

~~~~


@everyone who reply above
have you tried it? :|
 
suppose in directory "test" there are 20 sub-directories.

When you put ./script.sh test 25

it will compress the first directory (split it into 25mb), upload it and delete it then compress the other and so on.
 
rar Done

but error on upload

Uploading M_M.rar to HF
curl: Can't open 'M_M.rar'!
curl: try 'curl --help' for more information

i have installed curl if i upload use only command curl is working but if i use this script its not working
curl -T "M_M.rar" ftp.hotfile.com --user username:password
 
Status
Not open for further replies.
Back
Top