Forums

Wget a filesystem directory

I would like to use wget to download a directory from the pythonanywhere filesystem and recursively all the subdirectories. I have tried to set the entire path as static files but I still get 403 (forbidden) error. Any idea how it can be done?

You've probably not logged in on the wget session. There are better ways of downloading files from PythonAnywhere: http://help.pythonanywhere.com/pages/UploadingAndDownloadingFiles/

Thanks Glenn, i didn't think about Rsync, However, my point was to download a directory without authentication, to have a sort of public repository. I would rather prefer to keep my files in pythonanywhere than GitHub, so I can commit updates internally.

Sorry, I think Glenn missed out the "I have tried to set the entire path as static files but I still get 403 (forbidden) error" in your original post. Just to clarify -- can you download specific files (when you know the exact path)? Is the problem just with getting directory listings?

Here an example from http://tessarinseve.pythonanywhere.com/staticweb/PublicRepo.html .

I can, for instance, wget, a single file with:

wget  http://tessarinseve.pythonanywhere.com/PublicRepo/Physical-Constants-Chrome-Extension/README.md

But if I try to get the entire directory

wget -r http://tessarinseve.pythonanywhere.com/PublicRepo/Physical-Constants-Chrome-Extension/

I get 403 error.

Right -- that's how the system is configured, because the normal use case for static files is that you don't want people to be able to get directory listings.

Perhaps you could put a file called index.html in each directory that listed the files? It would need to be kept updated, of course, which would be a bit of a pain.

Thanks Giles