Unix/ls: Difference between revisions

8,360 bytes added ,  4 years ago
(Added Wren)
Line 604:
$
</pre>
 
=={{header|Furor}}==
The following program lists just the subdirectories, regular files and symlinks, because I do no need the another gizmos generally, but based on these abovementioned file types it is easy to expand with them, if it is necessary.
 
<lang Furor>
###sysinclude dir.uh
###sysinclude stringextra.uh
 
###define COLORS
// delete the COLORS directive above if you do not want colored output!
{ „vonal” __usebigbossnamespace myself "-" 90 makestring() }
{ „points” __usebigbossnamespace myself "." 60 makestring() }
#g argc 3 < { "." }{ 2 argv } sto mypath
@mypath 'd !istrue { ."The give directory doesn't exist! Exited.\n" end }
@mypath getdir { ."Cannot load the dir! Aborted.\n" end } sto mydir
 
@mydir ~d {
."Directories:\n"
@mydir ~d {| #s
@mydir 'd {} octalrights dup print free SPACE
@mydir 'd {} getfilename dup 37 stub print SPACE drop
@mydir 'd {} groupname ': !+
@mydir 'd {} ownername dup sto temp + dup 10 stub print free @temp free
@mydir 'd {} mtime dup print free
NL |}
@points sprint
@mydir ~d { ."Total: " @mydir ~d #g print ." subdirectories.\n" }
@vonal sprint
}
@mydir ~r {
."Regular files:\n"
@mydir ~r {| #s
@mydir 'r {} octalrights dup print free SPACE
@mydir 'r {} getfilesize sbr §ifcolored
@mydir 'r {} executable { ." >" }{ ." " } SPACE
@mydir 'r {} getfilename dup 37 stub print SPACE drop
@mydir 'r {} groupname ': !+
@mydir 'r {} ownername dup sto temp + dup 10 stub print free @temp free
@mydir 'r {} mtime dup print free
NL |}
@points sprint
@mydir ~r { ."Total: " @mydir ~r #g print ." regular files. "
."TotalSize = " @mydir 'r totalsize sbr §ifcolored NL
}
@vonal sprint
}
@mydir ~L {
."Symlinks:\n"
@mydir ~L {| #s
@mydir 'L {} octalrights dup print free SPACE
@mydir 'L {} executable { .">" }{ SPACE } SPACE
@mydir 'L {} getfilename dup 67 stub print SPACE drop
@mydir 'L {} broken { ."--->" }{ ."===>" } SPACE
@mydir 'L {} destination dup 30 stub print drop
NL |}
@points sprint
@mydir ~L { ."Total: " @mydir ~L #g print ." symlinks.\n"
}
}
@vonal sprint
."Size, alltogether = " @mydir alltotal sbr §ifcolored NL
@vonal sprint
@mydir free
."Free spaces: /* Total size of the filesystem is : " @mypath filesystemsize dup sto filsize sbr §ifcolored ." */\n"
." for non-privilegized use: " @mypath freenonpriv dup sbr §ifcolored
#g 100 * @filsize / ." ( " print ."% ) " NL
." All available free space: " @mypath totalfree dup sbr §ifcolored
#g 100 * @filsize / ." ( " print ."% ) " NL
end
 
ifcolored:
###ifdef COLORS
coloredsize
###endif
###ifndef COLORS
#g !(#s) 21 >|
###endif
dup sprint free
rts
 
{ „filsize” }
{ „mydir” }
{ „mypath” }
{ „temp” }
{ „makestring” #s * dup 10 !+ swap free #g = }
</lang>
 
{{out}}
An example output:
 
<pre>
Directories:
0775 arrays vz:vz 2020.05.08 15:00:34 P
0775 Brainfuck vz:vz 2020.03.28 16:06:37 Szo
0775 examples vz:vz 2020.06.07 19:26:48 V
0775 furorfonts vz:vz 2020.05.09 10:46:19 Szo
0775 furorheaders vz:vz 2020.06.02 00:37:36 K
0775 hasznosvolt vz:vz 2020.05.09 15:19:09 Szo
0775 headers vz:vz 2020.05.30 19:20:18 Szo
0775 kiserleti vz:vz 2020.05.13 19:24:23 Sze
0775 libraries vz:vz 2020.06.07 19:25:25 V
0775 OLD vz:vz 2020.06.07 23:29:10 V
0775 tests vz:vz 2020.03.16 23:00:47 H
0775 useful vz:vz 2020.06.07 23:24:42 V
............................................................
Total: 12 subdirectories.
------------------------------------------------------------------------------------------
Regular files:
0664 3313 __furor.c vz:vz 2020.05.23 14:30:17 Szo
0664 871113 A_Furor_programozasi_nyelv.odt vz:vz 2020.06.07 23:24:25 V
0664 9046 castingoperators.c vz:vz 2020.04.28 16:05:35 K
0664 32414 cmpoperators.c vz:vz 2020.06.06 18:23:20 Szo
0664 2424 dir.upu vz:vz 2020.06.09 09:47:00 K
0664 1187 eca.upu vz:vz 2020.06.07 23:13:06 V
0664 2630 fonttest.upu vz:vz 2020.05.24 23:43:48 V
0775 10756 > furor vz:vz 2020.06.07 19:25:25 V
0664 81 furordescriptorlength.upu vz:vz 2020.06.07 19:26:19 V
0664 85399 furorrun.c vz:vz 2020.06.07 19:25:12 V
0664 509 furt.upu vz:vz 2020.06.02 00:31:17 K
0664 13150 jumpingtable.c vz:vz 2020.06.06 20:58:26 Szo
0644 563834 Kajjam700.png vz:vz 2013.07.31 01:38:01 Sze
0664 21392 keywords.c vz:vz 2020.06.07 19:23:58 V
0664 5399 labelledloops.c vz:vz 2020.05.28 09:43:50 Cs
0664 2040 langtonsant.upu vz:vz 2020.05.25 15:25:41 H
0664 2581 libraries.sh vz:vz 2020.06.02 00:28:27 K
0664 84 link.txt vz:vz 2020.06.02 00:56:22 K
0664 41 lowercasealphabet.upu vz:vz 2020.06.05 22:40:34 P
0664 1035 Makefile vz:vz 2020.04.09 22:24:12 Cs
0664 1646 makeup.c vz:vz 2020.06.01 20:09:30 H
0664 884 mandelbrot9.upu vz:vz 2020.06.06 18:06:48 Szo
0664 22767 maze.upu vz:vz 2020.05.04 18:26:14 H
0664 669 myxmodmap.fur vz:vz 2020.05.11 18:51:59 H
0664 240 neglect.upu vz:vz 2020.05.16 19:33:13 Szo
0644 131072 pibinary.bin vz:vz 2018.06.07 22:36:54 Cs
0664 1270 pngxproba.upu vz:vz 2020.05.09 20:08:50 Szo
0664 1275 pngxproba2.upu vz:vz 2020.05.06 21:15:24 Sze
0644 504 preinitpostmortem.c vz:vz 2020.03.26 13:03:12 Cs
0644 5891695 primszamok.txt vz:vz 2017.01.23 18:33:14 H
0664 954 statusbar.upu vz:vz 2020.06.08 21:11:06 H
0664 3447 t.txt vz:vz 2020.06.08 22:00:05 H
0644 7401 UPU.syntax vz:vz 2020.05.25 22:34:33 H
0664 2000 verify.upu vz:vz 2020.04.29 21:10:02 Sze
0664 188 windowsresolutions.upu vz:vz 2020.06.02 00:36:08 K
0664 816 xproba.upu vz:vz 2020.05.11 11:39:39 H
0664 931 xprobafur.upu vz:vz 2020.05.11 18:49:16 H
............................................................
Total: 37 regular files. TotalSize = 7696187
------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
Size, alltogether = 7745339
------------------------------------------------------------------------------------------
Free spaces: /* Total size of the filesystem is : 126693117952 */
for non-privilegized use: 13951995904 ( 11% )
All available free space: 20411224064 ( 16% )
 
</pre>
 
It is not visible on the output above, but the digits in the filesize are colored, each 3 digits has different color.
 
 
 
 
 
=={{header|Gambas}}==
Anonymous user