delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/12/01/13:35:24

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,SPF_HELO_PASS,TW_CV,TW_VZ,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Corwin Joy <corwin DOT joy AT gmail DOT com>
Subject: Send To .tar.gz
Date: Wed, 1 Dec 2010 18:33:00 +0000 (UTC)
Lines: 36
Message-ID: <loom.20101201T192602-129@post.gmane.org>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

I use cygwin a lot and I wanted to create a windows XP "Send To" shortcut that
would allow me to "Send" a folder from windows explorer to a .tar.gz file. 
(Rather like the compress folder item, but compress to a .tar.gz format).  It
turned out to be fairly simple to create this, here is the code below in case
someone else wants to do this.

1. Create a script to compress a windows directory path. I called this
send_to_tar_gz.sh and placed it in my home directory.
---------
#!/bin/sh

bin=/bin # Executables in Cygwin space(Windows PATH may not include it)

if [ "${1}" = "" ];
	then
		XPATH=".";
	else
		XPATH="$($bin/cygpath -u -a "${1}")";
fi

echo "creating .tar.gz of" "$XPATH"

$bin/tar -cvzf "${XPATH}.tar.gz" "$XPATH"
-------

2. Create a windows "Send To" shortcut as explained here:
http://support.microsoft.com/kb/310270
C:\cygwin\bin\bash.exe --login -i send_to_tar_gz.sh

Note that I needed to use --login -i arguments because
a. I placed the shell script in my home directory.
b. If I just used bash the tar command had problems finding the gzip command to
compress the tar file, I'm not quite sure why.  Something to do with the path I
think.




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019