davlee1972 commented on issue #41357:
URL: https://github.com/apache/arrow/issues/41357#issuecomment-2077447457

   Here's my temporary fix for pyarrow.fs.LocalFileSystem..
   
   If the LocalFileSystem is running on Windows the use the function below to 
get FileInfo objects instead of get_file_info() / FileSelector()
   
   ```
       def windows_find_files(search_dir):
           file_info_objects = []
           dir_objects = os.scandir(search_dir)
           for dir_object in dir_objects:
   
               file_path = WindowsPath(dir_object.path).as_posix()
   
               if dir_object.is_file():
                   file_type = FileType.File
               elif dir_object.is_dir():
                   file_type = FileType.Directory
               else:
                   file_type = FileType.Unknown
   
               stat = dir_object.stat()
   
               file_info_objects.append(
                   FileInfo(
                       file_path,
                       type=file_type,
                       mtime=stat.st_mtime,
                       size=stat.st_size
                   )
               )
   
               if file_type == FileType.Directory:
                   subdir_objects = windows_find_files(file_path)
                   file_info_objects = file_info_objects + subdir_objects
   
           return file_info_objects
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to