0

Answers to how to remove the sparsefile file attribute appear to revolve around:

fsutil sparse setflag <filename> 0|1

This does not work for me.

I am on Windows 7 Pro 32-bit NTFS, as an administrator, using an elevated command prompt.

Following the various other answers, my last fail was as follows:

C:\_DELETEME>fsutil file createnew test.nul 1048576
File C:\_DELETEME\test.nul is created

C:\_DELETEME>dir
 Volume in drive C is Default
 Volume Serial Number is 4CC9-A1B7

 Directory of C:\_DELETEME

04/11/2015  08:16    <DIR>          .
04/11/2015  08:16    <DIR>          ..
...
04/11/2015  08:16         1,048,576 test.nul
...

C:\_DELETEME>fsutil sparse queryflag .\test.nul
This file is NOT set as sparse

C:\_DELETEME>fsutil sparse setflag .\test.nul

C:\_DELETEME>fsutil sparse queryflag .\test.nul
This file is set as sparse

C:\_DELETEME>fsutil sparse setrange .\test.nul 0 1048576

C:\_DELETEME>fsutil sparse queryflag .\test.nul
This file is set as sparse

C:\_DELETEME>fsutil sparse setflag .\test.nul 0
Usage : fsutil sparse setflag <filename>
   Eg : fsutil sparse setflag C:\Temp\sample.txt

C:\_DELETEME>fsutil sparse queryflag .\test.nul
This file is set as sparse

All evidence I've seen to date seems to indicate setflag accepts no parameters other than a file(path), e.g.:

https://technet.microsoft.com/en-gb/library/cc788025.aspx

C:\_DELETEME>fsutil sparse setflag .\test.nul 0
Usage : fsutil sparse setflag <filename>
   Eg : fsutil sparse setflag C:\Temp\sample.txt

Does anyone know how to remove/unset this attribute, idealy programaticaly (I'm looking to automate a P$ script using sdelete, sparsefiles seem to take ages)?

Or can you divine my schoolboy error?

2 Answers 2

0

EndUzr, what you've tried should work. I was able to successfully set the file as non-sparse using the command sequence you used in Windows 8.1 x64.

C:\Temp\test>fsutil sparse setrange .\test.nul 0 1048576

C:\Temp\test>fsutil sparse queryflag .\test.nul
This file is set as sparse

C:\Temp\test>fsutil sparse setflag .\test.nul 0

C:\Temp\test>fsutil sparse queryflag .\test.nul
This file is NOT set as sparse

Challenges I've faced setting files as non-sparse were when they were set read-only (attrib -R <file>) or when they were downloaded from the internet (PS> Unblock-File <file>). But, that doesn't seem to be the problem in your case. Are you up-to-date with Windows Updates?

2
  • Inny, thnx for the time & effort.
    – EndUzr
    Commented Nov 9, 2015 at 13:04
  • Yes I am up to date on updates. FWIW the issue (also) "manifests" on files created from scratch ('fsutil file createnew test.nul 1048576'), so I guess it's not going to be -R or a d/l file issue. FWIW I've just tried again on a Win 8.1 laptop (64-bit NTFS) and again got Usage : fsutil sparse queryflag <filename> Eg : fsutil sparse queryflag C:\Temp\sample.txt.
    – EndUzr
    Commented Nov 9, 2015 at 13:12
-2

just came across files with the RP attribs set and like you were curious. I set non R attrib as usual. Then found this thread looking into P attrib. I copied an RP file to the root of C:\ and presto it became attrib A only so the file lost the P attrib by being copied. Fo me this is the way to go as as although i'm ok with dos etc, i like easy. Regards. Win7/64 Bit.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .