internetarchive icon indicating copy to clipboard operation
internetarchive copied to clipboard

Download - not create subfolders?

Open imdavid555 opened this issue 2 years ago • 4 comments

Currently trying to download files from this location: https://archive.org/download/rvz-gc-usa-redump/RVZ-GC-USA-REDUMP/

Using the internet archive CLI, I have come up with this command: ia download --search="rvz-gc-usa-redump" -C --no-directories --destdir="/mnt/user/Media/Test" --glob=*.rvz

Unfortunately, this downloads the files with the subfolder so it looks like this: /mnt/user/Media/Test/RVZ-GC-USA-REDUMP/007 - Agent Under Fire (USA) (Rev 1).rvz

I would like to look like this: /mnt/user/Media/Test/007 - Agent Under Fire (USA) (Rev 1).rvz

Is this possible with the Internet Archive tool? I have also tried generating a list of download links using the IA CLI and then having Wget try downloading. But this generated 403 errors. The commands look like this ia list 'rvz-gc-usa-redump' -l --glob='*.rvz' > gamecube.txt wget -i '/mnt/user/Media/Test/gamecube2.txt' -p '/mnt/user/Media/Test'

Any help or guidance would be appreciated.

imdavid555 avatar Nov 24 '22 17:11 imdavid555

This is currently not how --no-directories works. It only prevents the creation of a separate directory with the item's name. I'm not sure whether this is working as intended or considered a bug.

Using ia download rvz-gc-usa-redump -C --destdir '/mnt/user/Media/Test' --glob '*.rvz' would be better. It references the identifier directly and ensures that the wildcard is not interpreted by the shell, but this does not solve your problem.

Your Wget command contains an error: You should use -P (capital P) instead of -p. For some reason you also need to be authenticated to access the files within that item: ia list rvz-gc-usa-redump --location --glob '*.rvz' | wget -i - --header 'Authorization: LOW [Your Access key]:[Your secret]' -P '/mnt/user/Media/Test/'

The command then works as you desire.

@jjjake: Should we have --no-directories working differently and putting all files directly in the working directory or is the current behaviour working as intended? The current behaviour seems rather sane to me and changing it would lead to problems when files in the subdirectories have the same name.

maxz avatar Nov 27 '22 11:11 maxz

@maxz Thank you so much so much for the command! Yes this is exactly what I wanted.

Would be great if IA would have this capability without wget. I will close since this solves my issue.

imdavid555 avatar Nov 27 '22 19:11 imdavid555

@maxz This is working as I intended it to, but I can definitely see how the name is confusing now or how others might want it to work differently.

I would suggest we change the current behavior, and preserve the existing behavior in a new option named something like --no-item-directory. This should happen in a major release.

jjjake avatar Dec 05 '22 20:12 jjjake