Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query Size on disk #43

Open
jtomori opened this issue Jul 26, 2024 · 1 comment
Open

Query Size on disk #43

jtomori opened this issue Jul 26, 2024 · 1 comment

Comments

@jtomori
Copy link

jtomori commented Jul 26, 2024

Hello,
first, thank you for sharing and maintaining p4vfs, it's very cool.

I'd like to ask if there's a way to programmatically query the Size on disk that I can see in the folder properties window. I'd like to know how much space a given p4vfs-managed directory takes on a disk.

I've tried various approaches, but without success. Mentioning some below:

  • CMD's dir command reports only the full size
  • Git BASH's du command reports the full size and hydrates files in the process
  • Sysinternals' du command reports both Size and Size on disk, but the latter is incorrect (there's a non-zero value)
  • Python's os.stat(file_path).st_size returns the full size

Best,
Juraj

@jessk-msft
Copy link
Collaborator

Hi Juraj,
That's a great question. A few suggestions:

  1. With Windows 11, you can use C:\Windows\System32\diskusage.exe. It will show the correct disk usage of NTFS $DATA streams similar to what Windows Explorer is showing. Graphical tools like WinDirStat is similar. It does require elevated permission though.

  2. The P4VFS source code contains three C++ functions which you may find interesting for calculating this info per-file. FileInfo::FileSize, FileInfo::FileUncompressedSize, FileInfo::FileDiskSize. They are used extensively in the P4VFS unit testing.

Regards
-Jess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants