Do anyone there have a script which
-delivers 8.3 DOS format for selected item(s) name(s)
-delivers 8.3 DOS format for selected item(s) full path(s)?
Reason:
Item Short Path/Name(s) (plus correspondent CKS command ID) is failing on win8 but works on a win7 virtualized machine (tested on current XY version plus an old 11.70). Rather than relying on a possible bug fix (possible win fault?), I'd like to have the option to have this function working flawlessly anywhere, even on such older version* which I need to stick together to.
Thanks in advance!
___
* ie, runret is not an option here, please.
script request - short DOS names
-
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
script request - short DOS names
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Re: script request - short DOS names
Are you sure that 8.3 filenames are enabled on that Win 8 system?
from a command prompt
And this could be scripted (some rules are here: https://en.wikipedia.org/wiki/8.3_filen ... t_filename)
but I stumbled upon an example that makes no sense to me:
http://answers.google.com/answers/threa ... 22710.html
Can't explain why the first item has the ~2 for it's short name...
Apart from that as an idea how to create it:
For full paths it's basically the same with a loop over all "\" separated tokens (excluding drive letter tokens / network paths)...
Code: Select all
fsutil 8dot3name query
And this could be scripted (some rules are here: https://en.wikipedia.org/wiki/8.3_filen ... t_filename)
but I stumbled upon an example that makes no sense to me:
http://answers.google.com/answers/threa ... 22710.html
Code: Select all
02/10/2004 11:52 <DIR> REGIST~2 RegisteredPackages
31/12/2004 02:38 <DIR> REGIST~1 Registration
Apart from that as an idea how to create it:
Code: Select all
// Convert long to short name
$item = <curitem>;
$base = gpc($item, "base");
$ext = gpc($item, "ext");
// Get the base name if it's less or equal to 8 chars or the condensed name
// with 6 chars, all spaces and dots removed
$short = (strlen($base) <= 8) ? $base : substr(regexreplace($base, "[ .]*"), 0, 6);
if ($short == $base) { $shortFinal = $short; }
else {
// List all items of the same type (extension | folder)
$type = (exists($item) == 1) ? "f" : "d";
$query = ($type == "f") ? "*." . gpc($item, "ext") . " /nf" : "/nd";
$sameType = quicksearch($query);
$index = gettokenindex($item, $sameType, <crlf>, "i");
// We need only the 1 - $index items, remove all following ones
$sameType = gettoken($sameType, $index, <crlf>, , 1);
// Now find all items that match our short name "enriched" with any amount
// of spaces or dots after each character
$pattern = regexreplace($short, "(.)", "$1[ .]*");
$matches = regexmatches($sameType, $pattern, <crlf>);
// The last index must be our new suffix "~<index>"...
$shortFinal = recase($short . "~" . gettoken($matches, "count", <crlf>) . (($type == "f") ? ".$ext" : ""), "U");
}
text $shortFinal;
One of my scripts helped you out? Please donate via Paypal
-
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: script request - short DOS names
It's stuff like that that prevented me from taking my efforts seriously...highend wrote: Can't explain why the first item has the ~2 for it's short name...
Another thing (which should be checked against that win7 'real world' scenario, assuming XY properly does the job when it works), which sounds pretty dumb as I don't see stuff like that in years now:
REGIST~1...REGIST~999 or REGI~999?
Your script deals with that?
Thanks for the support. Yet again.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Re: script request - short DOS names
Nope but it wouldn't be difficult to implement that. Just check how these files are generated with 0-99, 100-999, etc...
One of my scripts helped you out? Please donate via Paypal