Short File name

Just starting out? Need help? Post your questions and find answers here.
loulou2522
Enthusiast
Enthusiast
Posts: 399
Joined: Tue Oct 14, 2014 12:09 pm

Short File name

Post by loulou2522 »

How can i translate a long file name (more than 14 characters) to a short File name ?
example TOTO123456787890 to toto12~1
thanks
User avatar
CELTIC88
Enthusiast
Enthusiast
Posts: 151
Joined: Thu Sep 17, 2015 3:39 pm

Re: Short File name

Post by CELTIC88 »

hi ;)

https://docs.microsoft.com/en-us/window ... tpathnamew

Code: Select all

spath.s{300}
GetShortPathName_(#PB_Compiler_Home +"Examples\Sources\Data\CdPlayer.ico",@spath,300)

Debug spath
interested in Cybersecurity..
User avatar
Kiffi
Addict
Addict
Posts: 1206
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: Short File name

Post by Kiffi »

search for 'GetShortPathName_'
Hygge
User avatar
ts-soft
Always Here
Always Here
Posts: 5758
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Short File name

Post by ts-soft »

Attention:
https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getshortpathnamew wrote:This outcome is also possible with NTFS volumes because there's no guarantee that a short name will exist for a given long name.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
TI-994A
Addict
Addict
Posts: 2490
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore

Re: Short File name

Post by TI-994A »

ts-soft wrote:Attention:
https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getshortpathnamew wrote:This outcome is also possible with NTFS volumes because there's no guarantee that a short name will exist for a given long name.
To check if the file system supports the 8dot3 specification (dir /x):

Code: Select all

C:\>dir /x
Volume in drive C is xxxxxxxx
Volume Serial Number is xxxx-xxxx

Directory of C:\Program Files\PureBasic\Examples\Sources - Advanced\Atomic FTP Server

19/12/2018  08:04 PM    <DIR>                           .
19/12/2018  08:04 PM    <DIR>                           ..
09/07/2014  11:20 AM             5,132   ATOMIC~1.PB    Atomic FTP Server.pb
19/12/2018  08:04 PM    <DIR>                           FTP
06/10/2007  01:33 PM               944                  Readme.txt
To enable the 8dot3 specification (replace "D" with target drive letter):

Code: Select all

C:\>fsutil 8dot3name set D: 0
It should be noted that only files created henceforth will maintain the 8dot3 file names.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too!
Post Reply