by Luuk » Fri Apr 09, 2021 10:14 am
Im thinking only javascript can conduct both folder-paths and file-names using the same number?
There is Filters(12) with checkmarks only in "Files" and "Subfolder", so then using the PathMin=181.
But this only uses 181 to present the files, not to rename them.
Im certain the javascript does this, because Im tested with... newName=object("folder")+name
And it presents the whole filepathname.ext, so you could set a variable==object("folder")+name, and then do the math.
Its unfortunate, but I cannot conduct this logic inside the javascript, so this is an exiftool example using regex to shorten the names.
exiftool -q -r -ext * -fast4 -if "$FilePath=~/.{181}/" -p "${FilePath; s/(.*)(\.[^.\\]+)$/$2|$1/; s/(.{181}).*/$1/; s/(.*)\|(.*)/$2$1/; s/(.{180}).*/$1/}" . 2>nul
This only presents what the new names would look like, but its very easy to change for renaming, or creating backups, etc.
Im including it to describe the logic, so then hoping an expert might convert this logic into the javascript!
The -if uses a filter to only conduct FullPathNames with 181-or-more characters.
The first s/// converts Full/Path/Name.ext ===> .ext|Full/Path/Name (in case of different length .extensions).
The next s/// destoys the 182nd-or-more chars (keeping 181 because | still separating the .extension).
The next s/// converts .ext|Full/Path/Name ===> Full/Path/Name.ext so now its exactly 180-characters.
The last s/// converts any filenames that were missing an .extension.
Its not renaming anything, because only using -p "${FilePath; instead of -FileName"<${FilePath;
Hopefully, there can be some experts to convert this logic into javascript code, or maybe the javascript grants a much simpler way?
If nothing else, Im sure there is also gui applications to conduct this also, but Im not ever experimented with any.