Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: From: Paul Stodghill To: "'cygwin AT sourceware DOT cygnus DOT com'" Subject: RE: Obtaining short DOS file names? Date: Tue, 6 Jun 2000 13:19:38 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" This doesn't work under Win2k. First, it doesn't like "command.com". After changing that to "cmd", it just prints the date when the first was modified... > -----Original Message----- > From: Barry Buchbinder [mailto:BBUCHBINDER AT niaid DOT nih DOT gov] > Sent: Tuesday, June 06, 2000 12:43 PM > To: 'cygwin AT sourceware DOT cygnus DOT com' > Subject: RE: Obtaining short DOS file names? > > > 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 > -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com