creating sparse files on win32
Trent Mick
trentm at ActiveState.com
Tue Jul 15 13:49:22 EDT 2003
[erick_bodine at attbi.com wrote]
> I need to create some sparse files on a win32 system (2000 & 2003
> Server) in order to do some testing of another application (not
> python). I have been poking around the win32all extensions (win32file
> specifically) that come w/ ActivePython but can't find anything that
> allows me to create a file with the 'sparse file attribute' set.
>
> Has anyone done this in python?
I haven't done this but MSDN teels me here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/sparse_file_operations.asp
that one needs to use the FSCTL_SET_SPARSE control:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/fsctl_set_sparse.asp
The code sample on the latter link uses the DeviceIoControl() Win32 API
method:
>>> import win32file
>>> win32file.DeviceIoControl
<built-in function DeviceIoControl>
Also use this to determine if the file system supports sparse files:
>>> win32api.GetVolumeInformation
<built-in function GetVolumeInformation>
Hopefully that can give you a start.
Cheers,
Trent
--
Trent Mick
TrentM at ActiveState.com
More information about the Python-list
mailing list