Monday, July 29, 2019

Listing files in a directory: ls -altr

Script

#!/usr/local/bin/python3.5

import subprocess

subprocess.call(["ls", "-altr"])


Execution

total 128
-rwxr-xr-x.  1 root root   358 Feb  8 17:57 temperature-converter.py
-rwxr-xr-x.  1 root root  4035 Feb  8 18:20 k.py
-rwxr-xr-x.  1 root root  3437 Feb  9 06:30 sniff.py
-rwxr-xr-x.  1 root root   130 Feb  9 07:45 continue-example.py
dr-xr-xr-x. 23 root root  4096 Feb 17 05:06 ..
-rwxr-xr-x.  1 root root   146 Feb 17 05:22 a1
-rwxr-xr-x.  1 root root   250 Feb 17 06:50 fib
-rwxr-xr-x.  1 root root   195 Feb 17 06:51 alphabets
-rwxr-xr-x.  1 root root   250 Feb 17 06:55 prime-numbers
-rwxr-xr-x.  1 root root   229 Feb 17 07:06 if-else-then
-rwxr-xr-x.  1 root root   151 Feb 17 07:07 if-else-break
-rwxr-xr-x.  1 root root   173 Feb 17 07:25 for-loop
-rwxr-xr-x.  1 root root    89 Feb 17 17:27 whilingaway
-rwxr-xr-x.  1 root root   112 Feb 17 18:37 x
-rwxr-xr-x.  1 root root    87 Feb 18 05:26 hello.py
-rwxr-xr-x.  1 root root   377 Feb 19 20:53 inch-to-cm-using-functions.py
-rw-r--r--.  1 root root 12288 Feb 19 21:01 .inch-to-cm-using-functions.py.swp
-rwxr-xr-x.  1 root root   485 Feb 21 01:59 bowler-contribution.py
-rwxr-xr-x.  1 root root   348 Feb 21 04:18 yes-no-may-be.py
-rwxr-xr-x.  1 root root   778 Feb 21 04:52 local-and-global-variables-for-functions.py
-rwxr-xr-x.  1 root root   307 Feb 21 07:10 playing-with-functions.py
-rwxr-xr-x.  1 root root   158 Feb 21 22:29 one-to-25-nested-triangle.py
-rwxr-xr-x.  1 root root   366 Feb 22 03:26 christmas-tree.py
lrwxrwxrwx.  1 root root    30 Feb 25 20:46 localtime -> /usr/share/zoneinfo/US/Pacific
-rwxr-xr-x.  1 root root   492 Feb 25 21:00 timer.py
-rwxr-xr-x.  1 root root   711 Feb 25 22:01 extendtimer.py
-rwxr-xr-x.  1 root root   377 Feb 26 04:58 most-common-word-in-a-file.py
-rw-r--r--.  1 root root  6533 Feb 26 05:03 cricket-article.txt
-rwxr-xr-x.  1 root root    80 Feb 26 07:02 list-files.py
drwxr-xr-x.  2 root root  4096 Feb 26 07:02 .





No comments:

Post a Comment