Author Topic: [Classic Rexx] Set Long File Name  (Read 368 times)

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 329
  • Karma: +7/-0
    • View Profile
[Classic Rexx] Set Long File Name
« on: April 18, 2025, 07:50:14 pm »
You may have noticed that Seamonkey, Firefox or Thunderbird or another application all of a sudden (after a restart) has lost all or many settings/profiles etc.
This is not limited to those applications, but as they're a central part of what one use, more likely that you've also have seen.
Files downloaded from the internet these days usually have these long names and software ported from other systems create files with long file names, both for settings and other output.
The problem is that the file system sometimes loose the info about the long file name and revert to a short form with the length 8.3

To improve the chanse to recover files, one can set the .LONGNAME EA (Extended Attribute).
Ported software are unaware of the concept of EA, even "native" software doesn't write .LONGNAME EA to files, thus it is very strange to think that every application has to write .LONGNAME EA to files. It would be more appropiate if the IFS driver would handle something as that...

but JRescuer contain a litte script (setln.cmd) that set .LONGNAME of each file, so that one can recover and set the proper file name.

setln.cmd contain a function that call itself repeatedly (recursively) to go through files and set the .LONGNAME EA.
What the script lack, is the ability to set the file name nor output information about the process.

A rewrite would be interesting to explore that address the issue, as and update to the file system (JFS) and deeper understanding and acceptance to add the feature to the ifs driver is far away.

1. Change the recursive calls
2. Show output of what the script do
3. Rename files that has lost the name

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 329
  • Karma: +7/-0
    • View Profile
Re: [Classic Rexx] Set Long File Name
« Reply #1 on: April 18, 2025, 08:05:35 pm »
Warning!

This script may cause harm to your computer!
DO NOT USE UNLESS FULLY AWARE OF THE DANGER!

The attached script was inspired by setln.cmd, but also extended to handle "more" of the problems we face with our OS when we download files with national characters.

Those brave that may want try it should perhaps trace it line by line to see what it does to begin with.

Feel free to improve!

rename nls.zip to nls.ext
An important part of the script is the function that use unzip32.dll or unzip.exe to unpack the file nls.ext (that is a plain .zip-file)
nls.ext contain information about the characters valid in various languages.

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 329
  • Karma: +7/-0
    • View Profile
Re: [Classic Rexx] Set Long File Name
« Reply #2 on: April 19, 2025, 08:41:12 am »
I you copy files to external drives like I do it is important to set the EA for each file either before you copy each file or first thing.

Just bought my latest one the other day and started to copy files to it.
Files without EA attached to them are destined to get short names, possibly loosing all hope to recover the real name, causing all sorts of annoyances as the visible name and the real name behind doesn't match. Most may not notice, as you haven't given it a thought, but once you look at it closer... grrrr.

This script set .LONGNAME info and use it to rename each file name to the visible one, by adjusting the TITLE or if that doesn't work use the command rename. (comment out the "IF rc = 0 THEN" to allow it to actually rename the file)

Note the important yet subtle information about TITLE (in Rexx Tips & Tricks v3.60 for example).
Is there a way to get rid of the rename command?
« Last Edit: April 19, 2025, 12:07:45 pm by Jan-Erik Lärka »

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 329
  • Karma: +7/-0
    • View Profile
Re: [Classic Rexx] Set Long File Name
« Reply #3 on: April 23, 2025, 09:31:16 pm »
Someone may try to experiment with SysMoveObject and tell the rest of us if it is possible to use?