m1gin 568

Install ia Command Line Tool:

  • curl -LOs https://archive.org/download/ia-pex/ia
  • chmod +x ia

Install & Update using pip

  • pip install internetarchive --user
  • pip install --upgrade internetarchive --user

Configure:

ia configure

Upload:

ia upload <identifier> file.mp3

Upload a folder with its content:

ia upload m2gin /home/user/test-dir

This will create /home/user/test-dir automatically in archive.org item.

ia upload m2gin /home/user/test-dir --remote-name=sub/

This will transfer the files to /sub/home/user/test-dir in the collection

ia upload m2gin /home/test2/ --remote-name=sub2/

This will transfer only the content in local test2 folder (without path) to inside of sub2/ on archive.org.

Upload as single file to a subdirectory:

ia upload mbirgin eb122.mp3 --remote-name=Enlem_ve_Boylam/eb122.mp3

Upload with metadata:

ia upload mbirgin eb122.mp3 --remote-name=Enlem_ve_Boylam/eb122.mp3 --metadata="title:English Prepositions"

Upload Multiple Files by Looping

for c in {4..8}; do ia upload mbirgin $c.mp3 --remote-name=eb/$c.mp3 ; sleep 5; done;


List files in an item:

ia list m2gin

List all available information about the files:

ia list --all m2gin

List only matched files:

ia list --glob auto/tongue-twister/tr/*.mp3 m2gin


Delete

ia delete <identifier> <file>

Delete a file and all files derived from the specified file:

  • ia delete <identifier> <file> --cascade
  • ia delete mbirgin Enlem_Ve_Boylam/test.mp3 --cascade

Find some files and delete them

ia list --glob auto/tongue-twister/tr/*.mp3 m2gin | xargs -I {} ia delete m2gin {} --cascade

Copy & Move & Rename

  • ia copy <src-identifier>/<src-filename> <dest-identifier>/<dest-filename>
  • ia move m2gin/tekerleme2/mbirgin_-_tekerleme2_-_butesbihi.mp3 m2gin/site/tongue-twister/tr/mbirgin_-_tekerleme2_-_butesbihi.mp3

List some files and move them:

  • ia list --glob "tekerleme2/*.mp3" m2gin | while read l; do n=${l/tekerleme2\//site/tongue-twister/tr/}; echo $l : $n; ia move m2gin/$l m2gin/$n; done;


List files on the server and move the local files with the same path/name.

The terminal should be opened in the related path. Assuming the local mp3 files located in /home/user/Download/lugat/dizin/ses/. The terminal opened in /home/user/Download folder

ia list --glob "lugat/dizin/ses/*.mp3" diksiyon | xargs -I {} mv {} /home/user/Downloads/lugat/uploaded/


Get or modify medata of a collection

  • ia metadata m2gin
  • ia metadata help

Upload with no derivation:

ia upload m2gin --no-derive /home/test2/ --remote-name=sub2/


Reference: https://archive.org/services/docs/api/internetarchive/cli.html



check limit / queue status for a collection:

https://s3.us.archive.org/?check_limit=1&bucket=m2gin&accesskey=------my---key---


#archive.org #internetarchive #ia #ubuntu #linux #cli

Add to: