2

I plan to compress unused files in the WinSxS directory because the directory is too big.

To do so I enabled tracking of last file access time (fsutil behavior set disablelastaccess 0). I'll use the PC normally for a few days, but will also try to use every program I occasionally use. Then I want to enable NTFS compression for all files in WinSxS that haven't been accessed in the last month.

To do this manually I need to change the owner, then grant permission to modify, then set compression attribute.

Does someone already have a reliable batch script that does this (going through files in C:/Windows/WinSxS/**/* last accessed before date, change permissions, and set compression attribute)?

Peter
  • 4,552
  • 5
  • 28
  • 33
  • 1
    Hi Peter. 1) We aren't a script writing service, but we will help you if you get stuck. Where exactly are you getting stuck making the batch file you want? 2) whether is a "good" or "bad" idea depends on too many factors to make that an answerable question (IMO). Screwing with the WinSXS when you don't know what you're doing is ALWAYS a bad idea. :) – Ƭᴇcʜιᴇ007 Mar 12 '14 at 16:38
  • @techie007 definitely not a duplicate of that one. I'm not asking why it's large. I'm asking about how to do selective compression and about any known negative side-effects. – Peter Mar 12 '14 at 16:43
  • See this answer on that question http://superuser.com/a/8517/23133 for both techniques and comments/opinions as to if it's a good idea or not. Regardless of the possible dupe, as-is your question is too vague regarding the batch script help, and too opinion-based regarding if it's a 'bad idea' or not. But hey, takes more than my vote to close it. :) – Ƭᴇcʜιᴇ007 Mar 12 '14 at 16:49
  • @techie007 Clarification: I'm not asking about opinions if this is a bad idea. I'm asking for concrete reasons why it might be a bad idea. I put that in here because I expected that I'd probably get a few answers of the "Don't do this altough I don't know why" type, but in retrospect I guess I should have left it out because it puts 2 questions into 1. Removed the 2nd question. – Peter Mar 12 '14 at 16:59
  • Generally answer to whether something is a good or bad idea is opinion-based. You can do whatever you'd like, if it works, then it's fine. ;) The problem existing now with what's left (as before) is that you are just asking for a script to do "X" - doing as such this is off-topic (you're just asking for a product). When it comes to script writing help, post what you've got already, point out exactly where you're getting stuck, and explain what you've tried already. – Ƭᴇcʜιᴇ007 Mar 12 '14 at 17:04
  • @techie007 Generally answer to whether something is a good or bad idea is opinion-based. - Often true. Which is why **I never asked** wether this is a good or bad idea. I asked people who would only point out that this is a bad idea to at least explain why. This comment thread derailed. I'll stop now. – Peter Mar 12 '14 at 17:10
  • You could compress it, but it will slow the heck out of your computer. – surfasb Mar 12 '14 at 17:17
  • "if this is a bad idea, please tell me why" does not sound like you know if it's a bad idea or not -- to me anyways. Btu yeah, this is derailed now. :) – Ƭᴇcʜιᴇ007 Mar 12 '14 at 17:26
  • Before this question is closed by overzealous voters: I'm not splitting the question into parts, because that would make it useless to other users. I'll probably need to write the answer myself so give me some time before close-voting it. – Peter Mar 12 '14 at 17:27
  • 1
    Run "dism.exe /online /cleanup-image /startcomponentcleanup" which does compression of unused files (http://superuser.com/a/594216/174557) – magicandre1981 Mar 12 '14 at 19:38
  • have you tried the posted command to cleanup WinSxS? – magicandre1981 May 24 '14 at 05:36

1 Answers1

2

Windows 8 already includes compression of unused files if you have the latest Servicing Stackup installed. Open a command prompt as admin and run this command:

dism.exe /online /cleanup-image /startcomponentcleanup

This removes all replaced Updates and compresses the files which can't be removed in a diff file which reduces the size a lot:

enter image description here

As you can see the NTFS.sys files of the updates which can't be removed are dramatically smaller compared to the NTFS.sys which is used.

magicandre1981
  • 97,301
  • 30
  • 179
  • 245