Eric at Lucii.org on 11 Jun 2013 13:35:18 -0700 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [PLUG] wget options to retrieve file from github |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Wow, that's cool. Thanks! I'll test it out when I get some time and maybe make a shell alias or function out of it. Eric On 06/11/2013 01:47 PM, Douglas Muth wrote: > > It looks like that zipfile name is sent in the Location: header of the response. Check this out: > > $ curl -I https://github.com/mehrpadin/Superfish-for-Drupal/zipball/master 2>/dev/null |grep Location: Location: https://codeload.github.com/mehrpadin/Superfish-for-Drupal/legacy.zip/master > > > If that zipfile name is in the same location in every response (is it?), you could grab it like this: > > $ curl -I https://github.com/mehrpadin/Superfish-for-Drupal/zipball/master 2>/dev/null |grep Location: |cut -d/ -f6 legacy.zip > > > Putting it all together: > > wget -O `curl -I https://github.com/mehrpadin/Superfish-for-Drupal/zipball/master 2>/dev/null |grep Location: |cut -d/ -f6` https://github.com/mehrpadin/Superfish-for-Drupal/zipball/master > > > -- Doug > > -- Douglas T. Muth * Philadelphia, PA, USA http://www.dmuth.org/ > > > > On Tue, Jun 11, 2013 at 1:27 PM, Eric at Lucii.org <eric@lucii.org <mailto:eric@lucii.org>> wrote: > > Does anyone know if there is a way to use wget to download a file and have it use the actual file name instead of the part after the last slash? For example, this URL: > > https://github.com/mehrpadin/Superfish-for-Drupal/zipball/master > > I know that I can use -O filename.zip to rename the download file but I have no idea what the file should be named (other than maybe "superfish".) I can guess it's a zip file from the URL element "zipball". > > When I do this: > > wget --spider https://github.com/mehrpadin/Superfish-for-Drupal/zipball/master > > Spider mode enabled. Check if remote file exists. --2013-06-11 10:36:22-- https://github.com/mehrpadin/Superfish-for-Drupal/zipball/master Resolving github.com... 204.232.175.90 Connecting to github.com <http://github.com>|204.232.175.90|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://codeload.github.com/mehrpadin/Superfish-for-Drupal/legacy.zip/master [following] Spider mode enabled. Check if remote file exists. --2013-06-11 10:36:22-- https://codeload.github.com/mehrpadin/Superfish-for-Drupal/legacy.zip/master Resolving codeload.github.com... 204.232.175.86 Connecting to codeload.github.com <http://codeload.github.com>|204.232.175.86|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 55979 (55K) [application/zip] Remote file exists. > > ...I see that there is a sort-of actual filename in the URL: legacy.zip > > > Any hints/tips/tricks/cheat codes/insights would be appreciated, > > Oops, stumbled upon this: > > https://addons.mozilla.org/en-US/firefox/addon/cliget/ > > Very clever program - I think I'll use it even if I have to switch back to FireFox sometimes. > > Eric ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug > > > > > > > > > ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug > - -- # Eric Lucas # # "Oh, I have slipped the surly bond of earth # And danced the skies on laughter-silvered wings... # -- John Gillespie Magee Jr -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlG3ih0ACgkQ2sGpvXQrZ/5wlACfUer3SrhLtp+l7tv7Lii3HoBf t7wAoIuE95UUg2squAz8ahDgNK2b9hEm =NZhG -----END PGP SIGNATURE----- ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug