-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete_empty_folder.py
More file actions
35 lines (24 loc) · 883 Bytes
/
delete_empty_folder.py
File metadata and controls
35 lines (24 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python3
# delete_empty_folder.py
import os
import argparse
import delef
VERSION = "1.0"
arg_parser = argparse.ArgumentParser(prog="delete_empty_folders",
description="Delete empty Folders and returns the number of the deleted Folders.")
arg_parser.version = VERSION
arg_parser.add_argument("Path",
metavar="path",
type=str,
help="the path to work with")
arg_parser.add_argument("-v",
"--version",
action="version",
help="show the version of the program")
args = arg_parser.parse_args()
folderpath = args.Path
if not os.path.isdir(folderpath):
print("The path specified does not exist!")
exit()
ret = delef.delef(folderpath)
print("Deleted " + str(ret) + " folder(s)")