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