Dec-14-2017, 03:55 AM
i once wrote a recursive file lister in C. i want to make some changes to it. but i don't want to go back to coding in C to do that. i'd rather re-write it in Python, instead. but i want to keep most of the features, such as the file type selector options. here is the output from the +h or -h option
Output:lt1/forums /home/forums 1> rls +h
rls version 0.9.0
syntax:
rls [options] [names]
single letter options may be combined in a single command line token:
-a append '/' to directory names
-b show blocks allocated
-d -D show date (-d for local, -D for UTC)
-g -G show group name (-G for group number)
-h -H show this help and quit
-i show inode
-l show long format
-L show number of links
-m show mode
-n no recursion (maxdepth=0)
-N append nanoseconds to time (if available)
-p show where link points to
-q output nothing
-s show size
-S show time/date as raw seconds
-t -T show time and date (-t for local, -T for UTC)
-u -U show user name (-U for number)
-V show version number and quit
+a select directories (ascending)
+b select block devices
+c select character devices
+d select directories (descending)
+h +H show this help and quit
+f select regular files
+l select symlinks
+p select pipes
+s select sockets
+V show version number and quit
assignment options must be in separate command line tokens:
cd=<directory> change to this directory (multiple)
maxdepth=<num> maximum recursion depth
lt1/forums /home/forums 2>
the options parser allows combining + and - options in the same command argument token, so, commands like rls +fl-lp are allowed (this selects regular files an symlinks, showing long format plus link reference).