Page 1 of 1 1
Topic Options
#119226 - 2004-05-09 02:19 PM Compress command
attiahia Offline
Hey THIS is FUN

Registered: 2000-03-27
Posts: 268
I have developed a simple script working on connecting a few of our users to specific server and then use Xcopy to copy their data from a shared folder to their BC’s as a backup date on a weekly bases. The copied data will be saved with the name of date & time as:
Data backup(Main folder)\Backup 2004-04-28 12-00-01 then
Backup 2004-05-03 12-00-01 and so on.

Since this process is cumulative, the size of data backup folder will be increased gradually. Therefore, I am using a compress command to reduce the used space on the user BC.

SHELL '%COMSPEC% /E:1024 /C fileattributes.pl -change -compress ON -recurse E:\Data_Backup'
-compress mode: Specifies whether the "compress" file attribute should be enabled or disabled. Valid values to pass with the switch are ON or OFF.
-recurse: Change file and directory attribute recursively on all files and folders in the specified directory path(s).

I found fileattributes.pl within windows 2000 resource kite which installed on my computer additional to active perl and that’s why the command worked on my BC but it does not on the user BC’s because it is missing Perl Dll files.

Since it is imposable to install Perl on the users BC, any help will be appreciated. Thank you.

Top
#119227 - 2004-05-09 03:22 PM Re: Compress command
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I can compile your Perl script the resulting EXE will be 436K or a little larger if the script requires additional modules.

Since you are using KiXtart, a better solution would be to use WMI via COM an code this directly in KiXtart. These are the links that will get you or one the Board's better WMI coders a start.

CIM_DataFile

CompressEx Method of the CIM_DataFile Class

If I get additioanl time this weekend, I will try to get some code put together. If this WMI solution is pursued, I would suggest that a new thread be started in the "COM Scripting" forum.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#119228 - 2004-05-09 05:35 PM Re: Compress command
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
This seems to do the trick. Let me know how it works and I'll post it to the UDF forum...

Code:

; ======================================================================
;
; fnCompress - Uses WMI to compress files or folders
;
; NAME: fnCompress()
;
; AUTHOR: Christopher Shilt (christopher.shilt@relizon.com)
; DATE : 5/9/2004
;
; COMMENT:
;
; ========================================================================
Break On

fnCompress("D:\Target\tetrix") ?
;fnCompress("D:\Target\6to4svc.dll") ?
@ERROR " | " @SERROR ?

Function fnCompress($sTarget,Optional $sComputer)
Dim $objWMI,$colTarget
$sTarget = Join(Split($sTarget,"\"),"\\")
If Not $sComputer $sComputer=@WKSTA EndIf
$objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"+$sComputer+"\root\cimv2")
If @ERROR<0 Exit VAL("&"+Right(DecToHex(@ERROR),4)) EndIf
If GetFileAttr($sTarget) & 16
$colTarget = $objWMI.ExecQuery("Select * from CIM_Directory where name = '" + $sTarget + "'")
$fnCompress = 3
For Each $sTarget in $colTarget
$fnCompress = $sTarget.Compress
Next
Else
$colTarget = $objWMI.ExecQuery("Select * from CIM_Datafile where name = '" + $sTarget + "'")
$fnCompress = 2
For Each $sTarget in $colTarget
$fnCompress = $sTarget.Compress
Next
EndIf
Exit($fnCompress)
EndFunction


Top
#119229 - 2004-05-09 05:43 PM Re: Compress command
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Thanks for your help Chris. I hope the original poster appreciates your efforts as much as I. Good work.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#119230 - 2004-05-09 07:05 PM Re: Compress command
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
At first, I was a little confused about how the compression was happening. In other words, I wasn't sure if it was creating something similiar to a zip file, or one of those ms compressed files, or if it was NTFS compression. Reading through the links Howard provided gave me enough to figure out it was NTFS. When you post this to the UDFs you might either include a note about the type of compression, or I might suggest another name for the UDF be something like NTFSCompress().
_________________________
(... better days ahead)

Top
#119231 - 2004-05-09 07:06 PM Re: Compress command
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ja.
I wonder though how much this will compress anything...
_________________________
!

download KiXnet

Top
#119232 - 2004-05-10 03:06 PM Re: Compress command
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
See the COM forum to continue the discussion...

RFC: fnCompress - Use WMI to compress/uncompress NTFS files/directories

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.066 seconds in which 0.035 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org