From bfc782466bbb0fabf5898a792305ce8d51db7136 Mon Sep 17 00:00:00 2001 From: Manzoor Ahamed Date: Mon, 12 Jul 2021 17:18:11 +0530 Subject: [PATCH] Customized ls command using python --- 08-ls-cmd-my-version.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 08-ls-cmd-my-version.py diff --git a/08-ls-cmd-my-version.py b/08-ls-cmd-my-version.py new file mode 100755 index 0000000..e677700 --- /dev/null +++ b/08-ls-cmd-my-version.py @@ -0,0 +1,15 @@ +#!/opt/anaconda3/bin/python + +## Modules +import pathlib +import sys +import os +import subprocess + +## Checking the path existance +path = pathlib.Path(sys.argv[1]) +if path.exists(): + print(" Listing the file from the given directory %s"%sys.argv[1]) + subprocess.run("ls -la",shell=True) +else: + print("Path %s doesnt exist"%sys.argv[1])