SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 45 of 45
  1. #26
    SitePoint Addict IsaacV's Avatar
    Join Date
    Jan 2002
    Location
    Saint Petersburg
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you read the previous comments really really fast, writing the "thanks" and the "seanf " seems kid of funny Ha!

    Anyways, I read somewhere that you could use XML to zip any form of data.
    Pants.
    Join the NYFlava Fashions Contest

  2. #27
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by IsaacV
    If you read the previous comments really really fast, writing the "thanks" and the "seanf " seems kid of funny Ha!
    You have a point..

    I dunno if I want to XML, I was looking more towards the build in functions.

    Any other ideas?

    Thanks,
    ~someonewhois

  3. #28
    SitePoint Enthusiast
    Join Date
    Apr 2001
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here seems to be some gzip functions from php, but they look like they are for strings. There is also a page on zip, but I believe someone already posted about this. I don't really know if this helps or not, but I thought I should let you know.
    -Magriep

  4. #29
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I saw the Gzip ones, but I didn't udnerstand them.

    Any other ways?

    Thanks,
    ~someonewhois

  5. #30
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    after reading a bit on the Zlib Compression Functions Magriep pointed out, i think that's the best way to go... you can also take a look at the man-page for gzip... i think that would be an easier way if all you want is just to zip it up

  6. #31
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think gzip only works on single files. to get a whole directory, you need to use tar to get it into a single file and then gzip that. don't ask me how, cuz i don't know the exact syntax.
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  7. #32
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if it helps, the command to 'tar' a directory/file would be
    Code:
    shell> tar -cf target.tar filename
    where target.tar is the name of the archive you want to create and filename is the file/directory you want to tar...

    after that, you'd use gzip to zip it:
    Code:
    shell> gzip target.tar
    which would give you target.tar.gz

  8. #33
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, filename being what you want to zip?

    And any way to put this into PHP?

    Thanks,
    ~someonewhois

  9. #34
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    exec "tar -cf target.tar filename" ); 
    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  10. #35
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You would think I could guess that EXEC works with shell/command line stuff!

    Thanks,
    ~someonewhois

  11. #36
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Worked like a charm, and to untar it, how can I do that?

    Thanks,
    ~someonewhois

  12. #37
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also, how do I zip more than one file?

    Thanks,
    ~someonewhois

  13. #38
    SitePoint Enthusiast
    Join Date
    Apr 2001
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can use an array for the filenames and have it loop. I don't know how to unzip it never delt with it before
    -Magriep

  14. #39
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    to untar:
    Code:
    tar -xvf archive.tar
    you may want to remove to 'v' switch if it don't need what it does (which is to verbosely display results of the extraction process)

    and you do know that when i say filename, that includes folders right?

    to zip more than 1 file:
    Code:
    shell> gzip target1.tar target2.tar target3.tar
    just list the names of the files you want to unzip... let the shell do the work

  15. #40
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by redemption
    and you do know that when i say filename, that includes folders right?
    Do now!

    Ok, that solves my problems!

    Thanks,
    ~someonewhois

  16. #41
    SitePoint Wizard geiger's Avatar
    Join Date
    Jul 2001
    Posts
    2,459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any way to do this without installing anything on the server? For like a distributed script it's not feasable to make them all contact their hosts.

  17. #42
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you don't have to install anything if you're on a Unix, Linux or BSD server... if you wanted to use PHP's zipping functions, you could look up the function reference which i had pointed out it one of my earlier posts... i can't help you beyond that because i don't use them...

    in any case, you'd definitely need to, as you say, 'contact your hosts' since you're zipping the file which lies on the server... but i see what you mean with regards to portability/distributibility (sp?)... i don't think you can escape that though with the zlib functions since you'd still require your host to have installed the zlib extension...

  18. #43
    SitePoint Evangelist
    Join Date
    May 2002
    Location
    Barcelona, Spain
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    emtpy files

    do not pipe the output (>) that's why it's not working

    insead of
    PHP Code:
    exec"gzip -d /path/to/file.gz > /path/to/unzip/to" ); 
    you want
    PHP Code:
    exec"gzip -d /path/to/file.gz" ); 
    Used to prefer PHP.
    Now I prefer Maya but stuck with PHP
    bruji.com

  19. #44
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No you don't, then your don't know what your zipping..

  20. #45
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by seanf
    PHP Code:
    exec "tar -cf target.tar filename" ); 
    Sean
    You can skip the gzip step by using -z (which means zip), ie,
    PHP Code:
    exec "tar -cfz target.tar.gz target" ); 
    In target you can write a single file or a directory. tar will store all the files there and compress them using gzip.

    Paul


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •