It is currently Wed May 22, 2019 6:28 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Short File name
PostPosted: Fri Mar 15, 2019 11:37 am 
Offline
Enthusiast
Enthusiast

Joined: Tue Oct 14, 2014 12:09 pm
Posts: 233
How can i translate a long file name (more than 14 characters) to a short File name ?
example TOTO123456787890 to toto12~1
thanks


Top
 Profile  
Reply with quote  
 Post subject: Re: Short File name
PostPosted: Fri Mar 15, 2019 12:05 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Sep 17, 2015 3:39 pm
Posts: 131
hi ;)

https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getshortpathnamew

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

Debug spath

_________________
interested in Cybersecurity..


Top
 Profile  
Reply with quote  
 Post subject: Re: Short File name
PostPosted: Fri Mar 15, 2019 12:06 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Mar 02, 2004 1:20 pm
Posts: 1008
Location: Amphibios 9
search for 'GetShortPathName_'

_________________
Can't decide if i need a hug, an XXL coffee, 6 shots of vodka or 2 weeks of sleep.


Top
 Profile  
Reply with quote  
 Post subject: Re: Short File name
PostPosted: Fri Mar 15, 2019 3:53 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5754
Location: Berlin - Germany
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.70 | SpiderBasic 2.21 | Windows 10 Pro (x64) | Linux Mint 19.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Short File name
PostPosted: Fri Mar 15, 2019 5:30 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2011 3:47 am
Posts: 2212
Location: Singapore
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:
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:
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!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye