Mail Archives: cygwin/2000/06/06/12:48:31
This works on Win98.
Try putting this function in .bashrc
function sfn() {
command.com /c dir "$1" | sed -e '/^ /d' -e 's/^............/&^G/'
-e 's/^G.*$//' -e 's/ *$//' -e 's/ */\./'
}
(Note: "^G" is a control-G/bell, which I don't expect to find in a DOS
filename.)
Then if you just want a list, you can do the following
$ sfn dos_file_spec
If you want to feed the list to a program, do
$ prog `sfn dos_file_spec`
Remember to quote or escape anything that bash might expand.
Command.com must have the ".com" typed. I'm not sure that it will work or
can be easily adapted for cmd.exe. sfn takes a single argument.
It's ugly and slow, but it works for me. Excuse me if my sed programming
was less than elegant.
- Barry Buchbinder
-----Original Message-----
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
- Raw text -