www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/06/06/10:46:31

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <CE5C042F6A0CD411BBE000A0C9558F2C0C2602@exchange.cs.cornell.edu>
From: Paul Stodghill <stodghil AT cs DOT cornell DOT edu>
To: "'cygwin AT sourceware DOT cygnus DOT com'" <cygwin AT sourceware DOT cygnus DOT com>
Subject: RE: Obtaining short DOS file names?
Date: Tue, 6 Jun 2000 10:45:30 -0400
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)

------_=_NextPart_000_01BFCFC5.E1958926
Content-Type: text/plain;
	charset="iso-8859-1"

I've attached a Perl script that converts long file names to short file
names. Hope that some else finds this useful.


milhouse% perl shorten.pl  '/cygdrive/c/Program Files/Microsoft Visual \
Studio/VIntDev98/ScriptLibrary/RECORDSET.HTM'
/cygdrive/c/PROGRA~1/MICROS~4/VINTDE~1/SCRIPT~1/RECORD~1.HTM
milhouse% 

> -----Original Message-----
> From: Paul Stodghill [mailto:stodghil AT CS DOT Cornell DOT EDU]
> Sent: Wednesday, May 31, 2000 10:38 AM
> To: 'cygwin AT sourceware DOT cygnus DOT com'
> Subject: RE: Obtaining short DOS file names?
> 
> 
> Chris wrote,
> > There is no cygwin-specific way of getting the short file 
> > name.  The concept
> > has no meaning on UNIX.  There are Windows programs available 
> > which do this.
> > 'dir' is one of them, for instance.
> 
> Gotcha. I can hack something up from this.
> 
> > Is there some reason why quoting the filename doesn't work?
> 
> It would, but it will take me a while to track down all of 
> the places that
> the scripts are broken. I'm looking for something quick and 
> dirty to get
> going.
> 
> Thanks.
> 
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
> 


------_=_NextPart_000_01BFCFC5.E1958926
Content-Type: application/octet-stream;
	name="shorten.pl"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="shorten.pl"

# -*- perl -*-=0A=
=0A=
eval 'exec perl -S $0 ${1+"$@"}'=0A=
  if $running_under_some_shell;=0A=
=0A=
$FILE =3D $ARGV[0];=0A=
if ( "$FILE" eq "" ) {=0A=
  print "Usage: ntutils/shorten filename" > STDERR;=0A=
  exit 1=0A=
}=0A=
$FILE =3D `cygpath -w "$FILE"`;=0A=
chomp $FILE;=0A=
$FILE =3D~ s|\\|/|g;=0A=
=0A=
@STACK =3D reverse(split(/\//,$FILE));=0A=
=0A=
$NEWNAME =3D pop @STACK;=0A=
=0A=
while ( $#STACK >=3D 0 ) {=0A=
  $OLD_FILE =3D pop @STACK;=0A=
  $NEWNAME2 =3D $NEWNAME;=0A=
  $NEWNAME2 =3D~ s|/|\\|g;=0A=
  $NEW_FILE =3D `cmd /c \"dir /x \\\"$NEWNAME2\\\"\\\\\" | egrep =
\"$OLD_FILE\"\'$\' | cut -c40-51`;=0A=
  chomp $NEW_FILE;=0A=
  $NEW_FILE =3D~ s/ +$//;=0A=
  if ( $NEW_FILE eq "" ) { =0A=
    $NEW_FILE =3D $OLD_FILE; =0A=
  }=0A=
  $NEWNAME =3D $NEWNAME . "/" . $NEW_FILE;=0A=
}=0A=
=0A=
print `cygpath -u "$NEWNAME"`;=0A=


------_=_NextPart_000_01BFCFC5.E1958926
Content-Type: text/plain; charset=us-ascii

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
------_=_NextPart_000_01BFCFC5.E1958926--

- Raw text -


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