quote better
This commit is contained in:
18
flit.py
18
flit.py
@@ -6,7 +6,7 @@ import os
|
|||||||
import random
|
import random
|
||||||
import shutil
|
import shutil
|
||||||
import string
|
import string
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote_plus
|
||||||
|
|
||||||
|
|
||||||
DEL_TIME = '.delete_in'
|
DEL_TIME = '.delete_in'
|
||||||
@@ -43,6 +43,13 @@ def parse_opts():
|
|||||||
default = "",
|
default = "",
|
||||||
help = 'Root address for printing URLS'
|
help = 'Root address for printing URLS'
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--verbose', '-v',
|
||||||
|
action = "store_true",
|
||||||
|
dest = "verbose",
|
||||||
|
default = False,
|
||||||
|
help = 'Print individual files too'
|
||||||
|
)
|
||||||
|
|
||||||
subparsers = parser.add_subparsers(
|
subparsers = parser.add_subparsers(
|
||||||
dest="command",
|
dest="command",
|
||||||
@@ -106,7 +113,7 @@ def get_folder_names():
|
|||||||
return [p[0] for p in dir_list]
|
return [p[0] for p in dir_list]
|
||||||
|
|
||||||
|
|
||||||
def list_folders(root_folder):
|
def list_folders(root_folder, verbose = False):
|
||||||
names = get_folder_names()
|
names = get_folder_names()
|
||||||
print("Folder Created ToDelete InDays")
|
print("Folder Created ToDelete InDays")
|
||||||
for p in names:
|
for p in names:
|
||||||
@@ -121,8 +128,9 @@ def list_folders(root_folder):
|
|||||||
stats[2].days,
|
stats[2].days,
|
||||||
due
|
due
|
||||||
))
|
))
|
||||||
for sp in sub_files:
|
if verbose:
|
||||||
print(" {}/{}/{}".format(root_folder,p,quote(sp)))
|
for sp in sub_files:
|
||||||
|
print(" {}/{}/{}".format(root_folder,p,quote_plus(sp,"/")))
|
||||||
#print(p, stats, sub_files)
|
#print(p, stats, sub_files)
|
||||||
|
|
||||||
|
|
||||||
@@ -148,7 +156,7 @@ if __name__ == '__main__':
|
|||||||
print(opts.root + "/" + new_name)
|
print(opts.root + "/" + new_name)
|
||||||
|
|
||||||
if opts.command == "list" or opts.command == None:
|
if opts.command == "list" or opts.command == None:
|
||||||
list_folders(opts.root)
|
list_folders(opts.root, opts.verbose)
|
||||||
|
|
||||||
if opts.command == "del":
|
if opts.command == "del":
|
||||||
del_due_folders()
|
del_due_folders()
|
||||||
|
|||||||
Reference in New Issue
Block a user