Addono / HathiTrust-downloader

Small and simple command line tool to automate downloading pages from HathiTrust
https://addono.github.io/HathiTrust-downloader/
MIT License
35 stars 7 forks source link

Need your help, sir. How should I specify the download path? #12

Closed rainfoll closed 1 month ago

rainfoll commented 1 month ago

As the title shows, I use this code: hatitrust-downloader mdp.39015073487137 1 10 --name my-book I don’t know the specific location of the downloaded file on my computer. Can I let this code specify the path and download the book to the path I specify? Please help me, am a newbie.

Addono commented 1 month ago

Hey, it will always default to storing the files in the same place as you run the command from.

There are two ways you can control the directory where the file is stored:

  1. Change the directory where you run it from. For example, create a new folder for a book, open the terminal to run from that folder and run the tool from there. That way, the files will be written to that new folder.

  2. Use the --name parameter with a path-prefix. Whether to use / or \ in the path to denote folders is operating system dependend, so I can't get you a generally working example. But for Linux / Mac something like hathitrust-downloader mdp.39015073487137 1 10 --name my-book-dir/my-book.

rainfoll commented 1 week ago

Hey, it will always default to storing the files in the same place as you run the command from.嘿,它始终默认将文件存储在您运行命令的同一位置。

There are two ways you can control the directory where the file is stored:有两种方法可以控制存储文件的目录:

  1. Change the directory where you run it from. For example, create a new folder for a book, open the terminal to run from that folder and run the tool from there. That way, the files will be written to that new folder.更改运行它的目录。例如,为一本书创建一个新文件夹,打开终端以从该文件夹运行,然后从那里运行该工具。这样,文件将被写入该新文件夹。
  2. Use the --name parameter with a path-prefix. Whether to use / or \ in the path to denote folders is operating system dependend, so I can't get you a generally working example. But for Linux / Mac something like hathitrust-downloader mdp.39015073487137 1 10 --name my-book-dir/my-book.将 --name 参数与路径前缀一起使用。在路径中使用 /\ 来表示文件夹取决于操作系统,因此我无法为您提供一个通常有效的示例。但对于 Linux / Mac,类似于 hathitrust-downloader mdp.39015073487137 1 10 --name my-book-dir/my-book .

Thank you so much for your answer and help! I finally figured it out! Thank you for your contribution, you are really a genius! Awesome!

rainfoll commented 1 week ago

Hey, it will always default to storing the files in the same place as you run the command from.

There are two ways you can control the directory where the file is stored:

  1. Change the directory where you run it from. For example, create a new folder for a book, open the terminal to run from that folder and run the tool from there. That way, the files will be written to that new folder.
  2. Use the --name parameter with a path-prefix. Whether to use / or \ in the path to denote folders is operating system dependend, so I can't get you a generally working example. But for Linux / Mac something like hathitrust-downloader mdp.39015073487137 1 10 --name my-book-dir/my-book.

After experimentation, I found that in Windows, only the first method can be used to specify the specific path for book downloads, that is: in the specified folder, hold down the shift key, right-click to open PowerShell, and enter "hathitrust-downloader mdp.39015073487137 1 10 --name my-book".

Addono commented 1 week ago

Yeah, using CLI tools on Windows is a bit clunky, happy you figured it out :)