Re: Zipping/Compressing Files

Tech-Archive recommends: Speed Up your PC by fixing your registry



"Smithers" <A@xxxxx> wrote in news:eZISm9ZVFHA.4028@xxxxxxxxxxxxxxxxxxxx:

> Is there any feature built into Windows Server 2003 that enables the
> creation of zip files (compressed archives)?
>
> I want to somehow create a script or batch file that lets me pass in a
> parameter for the target file (the one to be compressed) and another
> parameter for the output file (the resulting zip file).
>
> If not built into the OS, I'd appreciate any suggestions for something
> affordable (PKWare's $600 server product is priced way out of my league).
>
> Thanks!
>
>
>

Yes, this is built-in to WS03. There are two compression types, NTFS
compression or the Compressed (zipped) Folders feature.

To create a compressed folder, you obtain the properties of the folder in
Explorer, then on the General tab you click Advanced. In Compress or
Encrypt attributes, you select Compress contents to save disk space. You
can also do this on a per-file basis. For more info see the Help topic
"File compression overview"

There is also a command called compact that (to quote the help for the
command) "Displays and alters the compression of files or directories on
NTFS partitions." This command can be used in scripts -- here is the full
text of the Help topic "Compact."

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 uncompression 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.

Remarks

The compact command, the command-line version of the NTFS file system
compression feature, displays and alters the compression attribute of files
and directories on NTFS partitions. The compression state of a directory
indicates whether files added to the directory will be automatically
compressed. When you set the compression state of a directory you do not
necessarily change the compression state of files that are already there.
You cannot use compact to read, write, or mount volumes that have been
compressed using DriveSpace or DoubleSpace.
You cannot use compact to compress file allocation table (FAT) or FAT32
partitions.

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



--
James McIllece, Microsoft

Please do not send email directly to this alias. This is my online account
name for newsgroup participation only.

This posting is provided "AS IS" with no warranties, and confers no rights.
.



Relevant Pages

  • Re: The Compressed (zipped) Folder is invalid or corrupted
    ... About 60 gig of data was residing in a normal folder ... To compress a file or folder on an NTFS drive ... You can only use NTFS compression for files and folders on drives ... Files and folders that are compressed using NTFS compression cannot be ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Files deleted but free space doesnt increase
    ... unchecked "Compress files in this folder" and let it work for a while. ... So is my problem that although I'm deleting hundreds of GB, ... is an NTFS volume with file compression enabled. ... echo %date% %time%> c:\test.txt ...
    (microsoft.public.windows.file_system)
  • Re: Low disc space
    ... Computer icon on the Desktop and select System Restore. ... especially if you do not store offline copies on disk. ... You will have a Local Settings folder for each User Profile. ... Enable drive level compression. ...
    (microsoft.public.windowsxp.hardware)
  • Re: backing-up
    ... Of they were too lazy to put them in the correct place. ... Do I Zip the Documents folder before or after I move the ... Yes its supposed to be but, I've found that it really does little compression basically it compress a very little but does encases it in a zip Archive, the desired files. ...
    (microsoft.public.mac.office.word)
  • questions on compressed (zipped) folder
    ... To create a zipped compressed folder ... ``Installing a different compression program to Windows will remove ... Windows extracts it and opens it with the apropriate ...
    (microsoft.public.windowsxp.help_and_support)