How to download a folder from google drive using terminal?

I was able to download a public shared file like this:

$ wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' \
-O FILENAME

Where FILEID must be replaced by the actual file ID. FILENAME is the path/filename where download will be stored.

Note you cannot use a folderid instead of fileid. I have used view source in a folder view where I could find the following HTML <div id="entry-0B0jxxycBojSwVW.... The string starting with 0B was the fileid.