Eric at Lucii.org on 11 Jun 2013 13:42:30 -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

Ah, clever, Thanks!  I'll have to experiment.
I have been burned in the past by tar or zip files that
dumped everything in the PWD thereby creating an immediate
cleanup task :-(     Maybe that's never true for github though?

Eric

On 06/11/2013 02:02 PM, Russ Thompson wrote:
> I've always done something along these lines, unless you prefer the zip format.
> 
> wget -L https://github.com/mehrpadin/Superfish-for-Drupal/archive/master.tar.gz -O - | tar xzv
> 
> - Russ
> 
> 
> On Tue, Jun 11, 2013 at 1:47 PM, Douglas Muth <doug.muth@gmail.com <mailto:doug.muth@gmail.com>> 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
> 
> 
> 
> 
> ___________________________________________________________________________ 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/

iEUEARECAAYFAlG3i9MACgkQ2sGpvXQrZ/6IWgCg8k0OFE6gW0yGRAxzvdFjyGj3
J08AmMNGe7DqK6/Ahp3mi/elDFIbTBs=
=HFbq
-----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