bug when stripping directories

This commit is contained in:
Paul Lecuq 2018-07-03 12:11:35 +02:00
parent 1cee844848
commit de1dde4a81

View File

@ -23,7 +23,7 @@ args = parser.parse_args()
mode = args.mode
backup_file = args.backup_file
directory = args.directory
directory = args.directory.rstrip("/")
def backup():
fd = open(backup_file,"w+")
@ -37,7 +37,7 @@ def backup():
result.append(res)
for f_name_tmp in result:
try:
f_name = f_name_tmp.lstrip(directory)
f_name = f_name_tmp.replace(directory,'').lstrip("/")
f_perm = str(oct(os.stat(f_name_tmp).st_mode))
line = "%s|%s\n" % (f_name,f_perm)
fd.write(line)