#11 2023-12-14 04:10

unnamed9710
Member
Registered: 2023-12-13
Posts: 2

Re: Long Path Solution?

den4b wrote:

use Regular Expressions or Pascal Script rules to move all flac files specifically to the first/root folder.

Could you please help me write the Regular Expressions or Pascal Script, whichever is easier

Offline

#12 2023-12-14 16:11

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Long Path Solution?

The script below will truncate the base name of files where the full path is longer than MaxPathLength, e.g. 260 characters. If the base name is sufficiently long for truncation, then the base name will get truncated and marked with TruncationMarker suffix. If the base name is shorter than what is needed for truncation, then the file will be skipped and marked with FailedMarker prefix. You can adjust the parameters (constants at the top of the script) as you see fit.

Note that you will need to add your files to ReNamer with the "long path" specification, prepending them with "\\?\", in order to rename them successfully, otherwise the operating system will refuse to rename files with paths longer than 260 characters.

const
  MaxPathLength = 260;
  TruncationMarker = '~';
  FailedMarker = '#';
var
  BaseName: WideString;
  ExcessLength, TruncateLength: Integer;
begin
  ExcessLength := Length(FilePath) - MaxPathLength;
  if ExcessLength > 0 then
  begin
    BaseName := WideExtractBaseName(FilePath);
    ExcessLength := ExcessLength + Length(TruncationMarker);
    if ExcessLength < Length(BaseName) then
    begin
      BaseName := Copy(BaseName, 1, Length(BaseName) - ExcessLength) + TruncationMarker;
      FileName := BaseName + WideExtractFileExt(FilePath);
    end
    else
    begin
      FileName := FailedMarker + BaseName + WideExtractFileExt(FilePath);
    end;
  end;
end.

Offline

#13 2023-12-17 07:38

unnamed9710
Member
Registered: 2023-12-13
Posts: 2

Re: Long Path Solution?

den4b wrote:

The script below will truncate the base name of files where the full path is longer than

It seems that "add Folder" and the folder includes long path files won't work?

Last edited by unnamed9710 (2023-12-17 07:38)

Offline

#14 2023-12-17 13:13

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Long Path Solution?

unnamed9710 wrote:

It seems that "add Folder" and the folder includes long path files won't work?

You have to use the Add Paths option via the File menu, and you have to add the "\\?\" prefix to all paths if you want the long path support.

For example, "C:\Very\Long\Path" would need to be added as "\\?\C:\Very\Long\Path", as described in the Long paths wiki article.

We are planning to introduce automatic handling of long paths in the next version of ReNamer, so you wouldn't need to apply this prefix manually in the future.

Offline

#15 2023-12-30 20:53

RNM001
Member
Registered: 2022-07-25
Posts: 2

Re: Long Path Solution?

Stefan wrote:
nkormanik wrote:

All I'm really after are the deeply included .flac files.



Maybe you should rather use a good file manager or a script of your OS.
....

Is it this what you want?

I find an excellent tool for moving or otherwise managing files is a program called "Everything". (voidtools.com).  It runs in the background indexing my drives - but despite worry about the overhead of that I find it is undetectable on my system (home user, but lots of files).

Then one would use the *.flac wildcard - which instantly shows the flac files - and perhaps sort by 'date created'.  Then it is easy to see the new files, or whatever choice you have, and move them to what you would consider a sensible directory.  Or, you could use that utility to drag them into Renamer and run the rename operation.

From me, a highly recommended utility.

Richard

Offline

Board footer

Powered by FluxBB