This method works great on Mac without using any plugin.  I'm not sure if it 
can be tweaked to work on Windows. 



  //zipFolderItem(sourcePath{;archivePath)->archivePath
  // -- zip file or folder. If success returns archivePath

C_TEXT($0;$1;$2;$cmd;$sourcePath;$archivePath)
C_LONGINT($ctr)
C_BOOLEAN($addToExisting)

$sourcePath:=$1
If (Count parameters=1)
$archivePath:=$sourcePath+".zip"
Else 
$archivePath:=$2
If ($archivePath#"@.zip")
$archivePath:=$archivePath+".zip"
End if 
$addToExisting:=True
End if 

If (Not($addToExisting))
  // get unique archive path
While ((Test path name($archivePath)=Is a document) | (Test path 
name($archivePath)=Is a folder))
$ctr:=$ctr+1
$archivePath:=$sourcePath+" "+String($ctr)+".zip"
End while 
End if 

$sourcePath:=Convert path system to POSIX($sourcePath)
$archivePath:=Convert path system to POSIX($archivePath)
$cmd:="ditto -c -k '"+$sourcePath+"' '"+$archivePath+"'"

LAUNCH EXTERNAL PROCESS($cmd)

$archivePath:=Convert path POSIX to system($archivePath)

If (Test path name($archivePath)=Is a document)
$0:=$archivePath
End if 

> On Jul 28, 2017, at 9:15 AM, 4d_tech-requ...@lists.4d.com wrote:
> 
> Message: 1
> Date: Thu, 27 Jul 2017 15:24:26 -0600
> From: Jody Bevan <jody.be...@gmail.com>
> To: 4D iNug Technical <4d_tech@lists.4d.com>
> Subject: zipping files
> Message-ID: <79da757f-505f-4dbf-be79-2604f8d53...@gmail.com>
> Content-Type: text/plain;     charset=utf-8
> 
> I have looked through the Knowledgebase, and past nug posts. I tried PHP to 
> do this but got no where (something obviously I am doing).
> I ended up (thus far) with miyako’s 4D plugin for zipping.
> 
> I go into his test db and try it out and it works perfectly. So now I want to 
> implement in our shell.
> 
> I place the plugin in the Plugin folder of our application and restart.
> 
> That is fine, and I now have a plugin that loads at startup and when I write 
> code the plugin command shows up as a plugin and the constants as well.
> 
> I run the code and it always fails!
> 
> So any ideas as to what I am doing wrong? Is this actually a component and 
> not ‘just’ a plug-in and I have to do more?
> 
> Any help appreciated, as I continue to struggle with this.
> 
> Thanks
> 
> Jody Bevan
> ARGUS Productions Inc.
> Developer
> Argus Productions Inc. <https://www.facebook.com/ArgusProductions/>

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to