{"id":10363,"date":"2011-06-22T07:00:00","date_gmt":"2011-06-22T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2011\/06\/22\/how-do-i-compress-files-via-ntfs-compression-from-the-command-line\/"},"modified":"2011-06-22T07:00:00","modified_gmt":"2011-06-22T07:00:00","slug":"how-do-i-compress-files-via-ntfs-compression-from-the-command-line","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20110622-00\/?p=10363","title":{"rendered":"How do I compress files (via NTFS compression) from the command line?"},"content":{"rendered":"<p>A customer wanted to know whether there was a way to compress files and directories (in the sense of NTFS compression) from a script or from the command line. They knew about the Properties dialog, but they wanted something scriptable.\n The command-line tool for this is <code>COMPACT.EXE<\/code>. Type <code>compact \/?<\/code> for usage information.\n The customer liaison was grateful for this information.<\/p>\n<blockquote class=\"q\"><p> Thanks for the prompt response, and yes, this will meet our customer&#8217;s need to compress specific files such as *.docx under a particular directory and all its subdirectories. <\/p><\/blockquote>\n<p> Um, *.docx files are already compressed. Compressing them again gains you nothing.<\/p>\n<p> <b>Bonus reading<\/b>: Functions for manipulating documents which follow the Open Package Conventions are available in both <a href=\"http:\/\/msdn.microsoft.com\/system.io.packaging.aspx\"> managed<\/a> and <a href=\"http:\/\/msdn.microsoft.com\/dd371623.aspx\"> unmanaged<\/a> versions. Check out the <a href=\"http:\/\/blogs.msdn.com\/opc\/\"> Packaging Team Blog<\/a> for more information, including <a href=\"http:\/\/blogs.msdn.com\/opc\/archive\/2009\/08\/05\/comparison-between-the-opc-managed-code-and-native-code-apis.aspx\"> a comparison of the managed and unmanaged versions<\/a>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>A customer wanted to know whether there was a way to compress files and directories (in the sense of NTFS compression) from a script or from the command line. They knew about the Properties dialog, but they wanted something scriptable. The command-line tool for this is COMPACT.EXE. Type compact \/? for usage information. The customer [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[104],"class_list":["post-10363","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-tipssupport"],"acf":[],"blog_post_summary":"<p>A customer wanted to know whether there was a way to compress files and directories (in the sense of NTFS compression) from a script or from the command line. They knew about the Properties dialog, but they wanted something scriptable. The command-line tool for this is COMPACT.EXE. Type compact \/? for usage information. The customer [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/10363","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=10363"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/10363\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=10363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=10363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=10363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}