extract compressed file

Belias
Belias Member Posts: 2,998
here's what i have to do:
1. i receive a compressed xml file...which is simply a file witout extension
2. i rename this file through navision, adding .zip extention (i can't do file.open and then file.rename as i can't open an extensionless file)
3. i extract the file
4. i rename the extracted file, adding .xml at the end (also the extracted file has not got extention)

how can i achieve this?i tried to search the net, but i only found how to compress and not vice versa...thanks in advance
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog

Comments

  • matttrax
    matttrax Member Posts: 2,309
    Well certainly NAV doesn't have a way to extract files. So you'll have to find some sort of ZIP program that can handle automation.

    Try searching MSDN for some of the Windows automations that you might be able to use within the NAV client. You might even be able to get access to the basic zip functionality in the OS.
  • reijermolenaar
    reijermolenaar Member Posts: 256
    Hi Belias,

    I once used the following component to zip and unzip files:
    http://www.xstandard.com/en/documentation/xzip/

    It works this this:
    CREATE(oZip);
    oZip.UnPack(YourZipFile, PathToUnzip);
    
    Reijer Molenaar
    Object Manager
  • Belias
    Belias Member Posts: 2,998
    i'll try your solution reijer...i've to connect to my "Trash" E-mail account and than i'll try it.
    BTW, i also found this
    http://dynamicsuser.net/blogs/dynamicslife/archive/2007/10/09/dl-zip-manipulations-using-windows-features.aspx
    but i couldn't understand how it can be used to extract files...
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • DaveT
    DaveT Member Posts: 1,039
    Hi Belias
    ZIPFolder.CopyHere(Filename); // just copying :) nice huh?
    Does the trick
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • Belias
    Belias Member Posts: 2,998
    @reijermolenaar: tried to do it, but it does not work
    @DaveT: i can't get it work, maybe there's something wrong in my zip file?
    here's my code
    TXTGnuCashFolder := 'C:\blahblah\150_ANI';
    CREATE(AUTShell);
    AUTZipFolder := AUTShell.NameSpace(TXTGnuCashFolder + '.zip');
    TXTFileName := 'C:\blahblah';
    AUTZipFolder.CopyHere(TXTFileName + '\test.xml');
    CLEAR(AUTShell);
    
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Belias
    Belias Member Posts: 2,998
    P.S.: the code i wrote is really odd, i'm only testing the feature...anyway it should work, if i understood the concept correctly...if not, DaveT, can you be more precise,please?
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog