Loading ...
Sorry, an error occurred while loading the content.

24388Re: ^$GetFiles([+]FilePath;FileSpecs[;Attr][;SortingOrder])$

Expand Messages
  • flo.gehrke
    Mar 28, 2014
      ---In ntb-clips@yahoogroups.com, <nullclip@...> wrote :

      > I desire to sort files by say, size.  However, when I get files
      > with the + parameter set (include subfolders), the files are
      > sorted by size within only their immediate folder; so it seems.
      > The files are not sorted by size overall.

      Try the following clip. It's just a basic concept but, so far, it works fine for me. It's designed for file sizes from 0 through 999.999.999.999 bytes.

      Please report any malfunctions!


      The clip:

      ^!SetHintInfo Working...
      ^!SetScreenUpdate Off
      ;  For example: Searching 'E:\Notetab\' and subdirectories for TXT files
      ^!Set %File%=^$GetFileFirst("+E:\Notetab\";"*.txt")$

      ^!Append %All%=^$GetFileSize(^%File%)$…^$GetExpandedName(^%File%)$^%NL%
      ^!Set %File%=^$GetFileNext$
      ^!IfEmpty ^%File% Out
      ^!Goto Loop

      ^!InsertText ^%All%
      ^!Replace "^" >> "^$StrFill(^%Space%;12)$" WARS
      ^!Replace "^[\x20\d]+(?<=(.{12}))" >> "$1" WARS
      ^!Replace "^(.{3})(.{3})(.{3})(.{3})" >> "$1.$2.$3.$4" WARS
      ^!Toolbar Sort Ascending
      ^!Jump ^$GetTextLineCount$
      ^!Find "^[\x20.]+\K[\d.]+" RS
      ^!Set %Size%=^$GetSelSize$
      ^!Replace "^[^…]+(?=…)(?<=(.{^%Size%}))" >> "$1" WARS
      ^!Replace "^[\x20]+\K\." >> "\x20" WARS
      ^!IfError Skip
      ^!Goto Skip_-2
      ^!Replace "…" >> "^%Space%" WAST
      ^!Jump Doc_Start
    • Show all 5 messages in this topic