Exemple #1
0
        def gen_local_file_path(folder: str):
            global roots, dirs
            for roots, dirs, files in os.walk(top=folder):
                for _file in files:
                    local_file_path = os.path.join(roots, _file)
                    _f = FilePathParser(full_path_file_string=local_file_path)
                    remote_file_path = _f.translate_to_linux_file()
                    yield local_file_path, remote_file_path, _f.source_name

            if len(dirs) > 0:
                for _dir in dirs:
                    local_folder_path = os.path.join(roots, _dir)
                    gen_local_file_path(folder=local_folder_path)
Exemple #2
0
 def test_translate_windows_file_to_linux(self):
     path = "C:\\foo\\bar\\cat.jpg"
     a = FilePathParser(full_path_file_string=path)
     b = a.translate_to_linux_file()
     print(b)