Page 1 of 1

List Command template

Posted: Tue Sep 25, 2012 10:15 am
by Amigo1
Hello, is there a way to include the "summary" of a directory listing when using LFORMAT?

Code: Select all

13.AmigaOS:> list ram:
Directory "ram:" on Tuesday 25-Sep-12
au.log                          156 ----rwed Today     08:24:39
Disk.info                      7946 ----rwed Today     08:24:25
> ENVARC:Sys/def_RAM.info
Clipboards                      Dir ----rwed Today     08:24:19
T                               Dir ----rwed Today     10:13:14
2 files - 7K bytes - 2 directories - 23 blocks used
Now, exept from the Link (which I don't need ATM) almost the same output is printed by

Code: Select all

13.AmigaOS:> list ram: sort=rt,name lformat "%-29n   %l %a %d %t"      
Clipboards                      Dir ----rwed Today     10:16:28
T                               Dir ----rwed Today     10:13:14
au.log                          156 ----rwed Today     08:24:39
Disk.info                       7946 ----rwed Today     08:24:25
but as you can see, the last line, specifically this one

Code: Select all

2 files - 7K bytes - 2 directories - 23 blocks used
is omitted.
Since I have some DVDs with long file names and I need to list their whole content and redirect the output to a file, I would like to have the complete usual list-output to be printed, including the summaries.
I think I have to use the LFORMAT option because of the long file names, and I can't see a way to format the output so to have a nice and clean justified listing.

Code: Select all

LIST DVD-001: SORT=RT,NAME ALL LFORMAT "%-50n   %l %a %d %t" >ram:DVD-001_Content.txt
if there is another way to achieve this, I'm all ears! :-)

Re: List Command template

Posted: Wed Sep 26, 2012 10:39 pm
by javierdlr
Here are the list LFORMAT variables:
Some new options allow you to specify fields to be printed in the
LFORMAT output. These options are:

%A Prints file attributes (protection bits).
%B Prints size of file in blocks.
%C Prints any comments attached to the file.
%D Prints the date associated with the file.
%E Prints the file extension.
%F Prints the full file parent path.
%G Prints the name of the group which 'owns' the file.
%K Prints the file key block.
%L Prints the length of file in bytes.
%M Prints the name of the file minus its extension.
%N Prints the name of the file.
%P Prints the file parent path.
%R Prints the name of the object the file/directory is linked to.
%T Prints the time associated with the file.
%U Prints the name user who 'owns' the file.
%V Prints group/other file attributes (protection bits).


Maybe '%R Prints the name of the object the file/directory is linked to.' is what you are looking.

Re: List Command template

Posted: Thu Sep 27, 2012 1:46 am
by Amigo1
Thanks for your reply. I have read the help file for the LIST command, which contains all the options you listed, but there isn't the option I'm looking for.

Try to LIST SYS: ALL, you will see, there is a summary at the end of each directory, plus one at the end of the complete output. These summaries are what I'm looking for.

Is there a way to format the output of the regular LIST command?
javierdlr wrote:Here are the list LFORMAT variables:
Some new options allow you to specify fields to be printed in the
LFORMAT output. These options are:

%A Prints file attributes (protection bits).
%B Prints size of file in blocks.
%C Prints any comments attached to the file.
%D Prints the date associated with the file.
%E Prints the file extension.
%F Prints the full file parent path.
%G Prints the name of the group which 'owns' the file.
%K Prints the file key block.
%L Prints the length of file in bytes.
%M Prints the name of the file minus its extension.
%N Prints the name of the file.
%P Prints the file parent path.
%R Prints the name of the object the file/directory is linked to.
%T Prints the time associated with the file.
%U Prints the name user who 'owns' the file.
%V Prints group/other file attributes (protection bits).


Maybe '%R Prints the name of the object the file/directory is linked to.' is what you are looking.

Re: List Command template

Posted: Thu Sep 27, 2012 2:10 pm
by AlexC
The intent behind LFORMAT seems to be mainly to produce a script-friendly output so there can't be any extra lines for the totals.

One option is to write an arexx perl or python script to scan the drawers or to reformat the output of List.
Another option is to use 'ls' from the SDK, you could try 'ls -AhlRt' and see if that output works for you
or with 'du' (also from the SDK) and a simple shell script you could mix the lformat and du output.

Re: List Command template

Posted: Thu Sep 27, 2012 2:38 pm
by javierdlr
Ok now I understand what you mean :-P
using c:FileSize in addition with LIST (don't know how)

#FileSize ""
147 ficheros, 3.156.796 bytes, 1.762 bloques


Maybe in a little script like this:
List LFORMAT=%s %d %t
FileSize ""