Page 2 of 2 <12
Topic Options
#81399 - 2003-01-02 06:01 PM Re: Need ShortFileName("File") Function
BrianTX Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
Hmm.. lots of discussion on this. I would vote for a pure KiXtart solution that would return either the specific short file name of a given file, or the short file name of a given long file name provided none was present if a location was specified.

For example, given a directory with a file:

c:\howdyguys.txt -lfn
c:\howdyg~1.txt -sfn (same file)

sfn("howdyguys.txt") would return:
howdyg~1.txt

sfn("howdyguys1.txt") would also return:
howdyg~1.txt

sfn("howdyguys.txt","c:\") would return:
howdyg~1.txt (because that's the short name of the existing file with that name)

sfn("howdyguys1.txt","c:\") would return:
howdyg~2.txt (because the file doesn't exist and there is already a howdyg~1.txt)
.......

Just my 2 cents.. a UDF could be written for this as well, but I don't think it could be done purely in KiXtart (without using command prompt or WSH).

Brian

Top
#81400 - 2003-01-02 10:37 PM Re: Need ShortFileName("File") Function
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I can do this easily, but it will require WSHPipe

or it will turn into a big slow script...

Any interest??

basically redirecting a DIR /x $x |find $y into a variable to substr it.

[ 02. January 2003, 22:41: Message edited by: Radimus ]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
Page 2 of 2 <12


Moderator:  Lonkero, ShaneEP, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 221 anonymous users online.
Newest Members
SHEBLU_HOSSAIN, JohnShearer, sam_white, Luuraap, mve666
17800 Registered Users

Generated in 0.079 seconds in which 0.05 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org