[Python] How can I detect "sparse"/download-on-demand files on Windows with Python?

Discussão em 'Python' iniciado por Stack, Março 31, 2025.

  1. Stack

    Stack Membro Participativo

    I have a question, I have files on disk created by Dropbox as files which are downloaded on demand. I uninstalled dropbox, but files were left on disk. I can see them in folder structure, I can see them with their sizes and other attributes in file explorer.

    When I check properties of file, I can see that file has 0 bytes size on disk, i.e. it is in fact not stored on drive at all.

    Is there a way in python how to detect those files so that I can delete them all?

    All functions in python I know will provide you with size of file only, i.e. size which you can see in attributes. But not real size on disk.

    Added 31MAR2025 17:49: As I mentioned above, with python functions like os.path.getsize() or os.stat() I get size which is 895420bytes, but I need to get 0 as Size on disk.

    Many thanks

    Vladimir [​IMG]

    Continue reading...

Compartilhe esta Página