Now cleans files correctly whether or not there is a slash in the directory_name
This commit is contained in:
parent
453a6c98a3
commit
545279d6c6
|
|
@ -28,6 +28,7 @@ def check_directory_exists(directory_name):
|
||||||
return os.path.isdir(directory_name)
|
return os.path.isdir(directory_name)
|
||||||
|
|
||||||
def clean_directory_name(directory_name):
|
def clean_directory_name(directory_name):
|
||||||
|
if '\\' in directory_name:
|
||||||
# Find the last occurrence of backslash
|
# Find the last occurrence of backslash
|
||||||
last_backslash_index = directory_name.rfind('\\')
|
last_backslash_index = directory_name.rfind('\\')
|
||||||
|
|
||||||
|
|
@ -40,6 +41,8 @@ def clean_directory_name(directory_name):
|
||||||
else:
|
else:
|
||||||
# If '[' doesn't exist, keep the original string
|
# If '[' doesn't exist, keep the original string
|
||||||
return directory_name
|
return directory_name
|
||||||
|
else:
|
||||||
|
return directory_name.rsplit("[", 1)[0]
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) != 2:
|
if len(sys.argv) != 2:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user