wkentaro / gdown

Google Drive Public File Downloader when Curl/Wget Fails
MIT License
4.11k stars 343 forks source link

--folder raises FileNotFoundError if files on Google Drive have slashes in their names #180

Closed bryzgaloff closed 2 years ago

bryzgaloff commented 2 years ago

My folder has a file named January/February 2020.csv (and several others with the same naming pattern). Running gdown --folder <url> -O /tmp/my-local-dir/ results in FileNotFoundError: [Errno 2] No such file or directory: '/tmp/my-local-dir/January' (treating January/ as a local filesystem subdirectory).

I have fixed this locally by patching file_name = file.name.replace(osp.sep, '_') here:

https://github.com/wkentaro/gdown/blob/main/gdown/download_folder.py#L239-L250

But I am not sure if this is the only and the right place to fix this, so decided to first create an issue and not a PR. I may create a PR if you tell me which places should this affect too.