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
|