bug when stripping directories
This commit is contained in:
parent
1cee844848
commit
de1dde4a81
@ -23,7 +23,7 @@ args = parser.parse_args()
|
|||||||
|
|
||||||
mode = args.mode
|
mode = args.mode
|
||||||
backup_file = args.backup_file
|
backup_file = args.backup_file
|
||||||
directory = args.directory
|
directory = args.directory.rstrip("/")
|
||||||
|
|
||||||
def backup():
|
def backup():
|
||||||
fd = open(backup_file,"w+")
|
fd = open(backup_file,"w+")
|
||||||
@ -37,7 +37,7 @@ def backup():
|
|||||||
result.append(res)
|
result.append(res)
|
||||||
for f_name_tmp in result:
|
for f_name_tmp in result:
|
||||||
try:
|
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))
|
f_perm = str(oct(os.stat(f_name_tmp).st_mode))
|
||||||
line = "%s|%s\n" % (f_name,f_perm)
|
line = "%s|%s\n" % (f_name,f_perm)
|
||||||
fd.write(line)
|
fd.write(line)
|
||||||
|
Loading…
Reference in New Issue
Block a user