fsutil file
Finds a file by user name (if Disk Quotas are enabled), queries allocated ranges for a file, sets a file's short name, sets a file's valid data length, sets zero data for a file, or creates a new file. Windows commands reference
On Windows
Windows
fsutil file [createnew] <filename> <length>fsutil file [findbysid] <username> <directory>fsutil file [optimizemetadata] [/A] <filename>fsutil file [queryallocranges] offset=<offset> length=<length> <filename>fsutil file [queryextents] [/R] <filename> [<startingvcn> [<numvcns>]]fsutil file [queryfileid] <filename>fsutil file [queryfilenamebyid] <volume> <fileid>fsutil file [queryoptimizemetadata] <filename>fsutil file [queryvaliddata] [/R] [/D] <filename>fsutil file [seteof] <filename> <length>fsutil file [setshortname] <filename> <shortname>fsutil file [setvaliddata] <filename> <datalength>
Show 27 options
createnewCreates a file of the specified name and size, with content that consists of zeroes.<length>Specifies the file's valid data length.findbysidFinds files that belong to a specified user on NTFS volumes where Disk Quotas are enabled.<username>Specifies the user's user name or logon name.<directory>Specifies the full path to the directory, for example C:\users.optimizemetadataThis performs an immediate compaction of the metadata for a given file./aAnalyze file metadata before and after optimization.queryallocrangesQueries the allocated ranges for a file on an NTFS volume. Useful for determining whether a file has sparse regions.offset=<offset>Specifies the start of the range that should be set to zeroes.length=<length>Specifies the length of the range (in bytes).queryextentsQueries extents for a file./rIf <filename> is a reparse point, open it rather than its target.<startingvcn>Specifies first VCN to query. If omitted, start at VCN 0.<numvcns>Number of VCNs to query. If omitted or 0, query until EOF.queryfileidQueries the file ID of a file on an NTFS volume.<volume>Specifies the volume as drive name followed by a colon.queryfilenamebyidDisplays a random link name for a specified file ID on an NTFS volume. Since a file can have more than one link name pointing to that file, it is not guaranteed which file link will be provided as a result of the query for the file name.<fileid>Specifies the ID of the file on an NTFS volume.queryoptimizemetadataQueries the metadata state of a file.queryvaliddataQueries the valid data length for a file./dDisplay detailed valid data information.seteofSets the EOF of the given file.setshortnameSets the short name (8.3 character-length file name) for a file on an NTFS volume.<shortname>Specifies the file's short name.setvaliddataSets the valid data length for a file on an NTFS volume.<datalength>Specifies the length of the file in bytes.setzerodataSets a range (specified by offset and length) of the file to zeroes, which empties the file. If the file is a sparse file, the underlying allocation units are decommitted.