[fbcocoa] Re: [fbcocoa] NSTask & gzip

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2010 : Group Archive : Group : All Groups

From: Deep <Info@...>
Date: Sun, 28 Nov 2010 15:40:17 +0000
To compress more than one file into a single archive, use the '-c' option:

gzip -c filename1 filename2 > two-files.gz


This technique can be used to avoid replacing the original file:

gzip -c filename > filename.gz

The '-c' option is actually sending the compressed file to the terminal.



> From: Bernie <fbcocoa.bw@...>
> Reply-To: <fbcocoa@...>
> Date: Sun, 28 Nov 2010 15:24:32 +0000
> To: <fbcocoa@...>
> Subject: [fbcocoa] NSTask & gzip
> 
> 
> Have used NSTask to execute Terminal commands before but having trouble with
> gzip. I'm guessing my arguments are not set up correctly. Anyone see what's
> wrong in this example?
> 
> '---------------
> include "Util_FileDirectory.incl"
> 
> BeginCFunction
> void ZipFile( CFStringRef inPath )
> {
> NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
> NSTask *task = [[[NSTask alloc] init] autorelease];
> [task setLaunchPath:@"/usr/bin/gzip"];
>  NSString *outPath = [[[NSString alloc] initWithFormat:@"%@.zip",(NSString
> *)inPath] autorelease];
> [task setArguments:[NSArray arrayWithObjects:@"-c",@"-P",@"rotide",(NSString
> *)inPath,@">",outPath,nil]];
> [task launch];
> [pool drain];
> }
> EndC
> toolbox ZipFile( CFStringRef inPath )
> 
> dim as FSRef ref
> dim as CFStringRef path
> 
> long if ( files$( _FSRefOpen,,, ref ) )
> fn FD_FSRefCreatePath( @ref, @path )
> ZipFile( path )
> CFRelease( path )
> end if
> 
> RunApplicationEventLoop()
> '---------------
> 
> Bernie
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fbcocoa-unsubscribe@...
> For additional commands, e-mail: fbcocoa-help@...
>