mass upload bash script (good for Megaupload)

Status
Not open for further replies.

Mutikasa

Active Member
314
2011
36
0
It's not much, but I'm sure it will help someone. I searched if it exists and didn't find, so.

If u wanna upload via FTP all your files in one folder do this:
1. in text editor write code, use ftp server of your choice
Code:
#!/bin/bash

ftp -inv << FTP
open ftp.eu.filesonic.com
user USERNAME PASSWORD
lcd /YOUR/FOLDER/WITH/FILES
mput *.zip
bye
FTP
2. save as with .sh extension
3. run like
Code:
bash yourfile.sh
or
Code:
./yourfile.sh
Megaupload doesn't have FTP for free users, but there's tool called Plowshare. http://code.google.com/p/plowshare/
It's easy to use.
here's the script for mass upload to MU:
Code:
#!/bin/bash

for file in /path/to/yourfiles/*.zip;
do
plowup --auth=username:password megaupload "${file}";
done;
for rapidshare change "megaupload" to "rapidshare" or "filesonic" or whatever it supports.
you can change "zip" to whatever extension you're using or just put "*" for every file in folder. Just save it as .sh and run.

Of course you can put all in one file and add more FTP or plowup to upload to more filehosts.
I was doing this for rapidshare, megaupload, fileserve, filejungle, filesonic. Just run and relax.
 
Last edited:
7 comments
You cannot upload at the same time with one process, but
you can try to run process in the background then start another process.
For example, if u have one script for folder A and u name it A.sh, and another for folder B with name B.sh you can upload that two folders at the same time like this:
& stands "to run in background"
Code:
./A.sh &
then run another
Code:
./B.sh
you can put B.sh in background if u like.
Still, you must not close the terminal. If u want to close the terminal use "nohup" command like this:
Code:
nohup ./A.sh &
although I never used this so don't know how it works. If it works good, if not, post here what it says.
 
I'm not sure my question was clear. This uploads all the files from a folder one file at a time, is there a way to edit the script to have it upload all the files at once?
 
I understood you, but I'm not sure what is your knowledge about this.
You will have to incorporate the commands I stated above.
Make separate script for every file you have in folder, then run all the scripts in background.
Like this:
Code:
#!/bin/bash

## this will create script for every file
x=1
for file in /path/to/your/folder/*.zip
do
cat > ${x}.sh << EOF
ftp -inv << FTP
open ftp.eu.filesonic.com
user USERNAME PASSWORD
put "${file}" "${file}"
bye
FTP
EOF
let x=x+1
done

## this will run all scripts in the background
for ((i=1; i<=${x}; i++))
do
./${i}.sh &
done

This is not tested, I wrote the code out of the head
 
Status
Not open for further replies.
Back
Top