Compression+tool+in+the+command+line+file+How+to+use

Compression tool in the command line file How to use

You know you can compress files and folders in XP by right clicking, selecting Properties and clicking the Advanced button.

But did you know there's also a command line compression utility? And it will do some things you can't do through the GUI. For example, you can compress just the files on a drive that have the .bmp extension. Here's how: 1. 1. Click Start | Run. 2. Type cmd to open the command prompt window. 3. At the command prompt, go to the folder within which you want to compress files or if you want to compress all files of this type on a drive, go to the root of the drive. 4. For example, if the folder within which you want to compress is named MYFILES, type the following: compact /c /s:\myfiles *.bmp

Compact Displays and alters the compression of files or directories on NTFS partitions. Used without parameters, compact displays the compression state of the current directory. Syntax compact [{/c|/u}] [/s[:dir]] [/a] [/i] [/f] [/q] [FileName[...]]

Parameters /c : Compresses the specified directory or file. /u : Uncompresses the specified directory or file. /s:dir : Specifies that the requested action (compress or uncompress) be applied to all subdirectories of the specified directory, or of the current directory if none is specified. /a : Displays hidden or system files. /i : Ignores errors. /f : Forces compression or un-compression of the specified directory or file. This is used in the case of a file that was partly compressed when the operation was interrupted by a system crash. To force the file to be compressed in its entirety, use the /c and /f parameters and specify the partially compressed file. /q : Reports only the most essential information. FileName : Specifies the file or directory. You can use multiple file names and wildcard characters (* and ?). /? : Displays help at the command prompt.

Examples To set the compression state of the current folder and its subfolders and existing files, from the current folder, type: compact /c /s To set the compression state of files in the current folder, subfolders in the current folder, and files within all subfolders without altering the compression state of the current folder, from the current folder, type: compact /c /s *.* To compress a volume, from the root folder of the volume, type: compact /c /i /s:\ This example sets the compression state of the root folder and all folders on the volume and compresses every file on the volume. By using the /i parameter, you ensure that error messages do not interrupt the compression process. To compress all files that end in .bmp in the \Tmp directory and all subdirectories of \Tmp, but not modify the compressed attribute of these directories, type: compact /c /s:\tmp *.bmp To force complete compression of the file Zebra.bmp, which was partially compressed at the time of a system crash, type: compact /c /f zebra.bmp To remove the compressed attribute from the directory C:\Tmp, but not change the compression state of any files in that directory, type: compact /u c:\tmp  