Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a script somewhere that will allow me to upload files to an archive.org project? I'd like to be able to simply run a script on a folder and have it upload and then spit out a list of URLs, for free, permanent, file hosting.

share|improve this question

closed as off-topic by Braiam, NikTh, Eric Carvalho, Avinash Raj, Ask Feb 15 at 7:17

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – Braiam, NikTh, Eric Carvalho, Avinash Raj, Ask
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 3 down vote accepted

Actually, I should have spent about 30 more seconds on Google ...

http://www.archive.org/help/abouts3.txt says I can use the s3cmd tool: sudo apt-get install s3cmd And then edit the configuration file, so ~/.s3cfg looks like:

[default]
host_base = s3.us.archive.org
host_bucket = %(bucket)s.s3.us.archive.org
access_key = key
secret_key = key
use_https = False
verbosity = WARNING

Then use the following script to upload everything to archive.org:

#!/bin/sh
BASE_URL=http://archive.org/details/
BASE_HEADER=something-$(date -u +%s) #something that should be unique
echo Converts to PDF and uploads the contents of a directory given as the command-line argument.
echo Now converting PDF to JPG
for file in `ls $1/*.pdf`
do
   convert $file `echo $file | sed 's/\.pdf$/\.jpg/'`
done
echo Listing JPGs: #make sure the conversion worked
ls $1/*.jpg
echo Making the bucket...
s3cmd mb s3://$BASE_HEADER
echo Sleeping...#sometimes it takes a moment to be processed on their end
sleep 20
echo Uploading files...
for file in `ls $1`
do
        s3cmd put $1/$file s3://$BASE_HEADER/$file
done
echo $BASE_URL$BASE_HEADER

It's run like upload.sh ~/stuff/

share|improve this answer
    
(The converting to JPG was for the specific project I'm working on.) –  Ben Mar 31 '11 at 2:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.