Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Aug 2008
    Posts
    77
    Thanks
    23
    Thanked 0 Times in 0 Posts

    Question Compress a directory and all its multilevel subdirectories using php, tar and gz

    Hi!
    I need a "very simple" PHP script which can compress a directory and all its multi-(infinite)level sub-directories using with .tar and .gz
    I have tried many complex scripts so far which don't work as most of them use ZIP and I don't have access to ZIP
    And a few of the simple ones, just don't function.

    Please help!

    Thank you !

    - Xeirus.

  • #2
    Regular Coder
    Join Date
    Jul 2010
    Location
    Oregon City
    Posts
    280
    Thanks
    5
    Thanked 50 Times in 49 Posts
    why cant you just use tar cvfz filename.tar.gz /directory

  • #3
    New Coder
    Join Date
    Aug 2008
    Posts
    77
    Thanks
    23
    Thanked 0 Times in 0 Posts
    I'm trying this now:
    PHP Code:
    exec('tar cvfz mytarfile.tgz /home/public/images/'); 
    But nothing happens.

    Any idea?

  • #4
    Regular Coder
    Join Date
    Jul 2010
    Location
    Oregon City
    Posts
    280
    Thanks
    5
    Thanked 50 Times in 49 Posts
    Quote Originally Posted by xeirus View Post
    I'm trying this now:
    PHP Code:
    exec('tar cvfz mytarfile.tgz /home/public/images/'); 
    But nothing happens.

    Any idea?

    do you have access to a command line? i was compressing some folder the other day with like 160mb of images in it an it wasn't working executing it via web browser, but it worked in the command line.

  • #5
    New Coder
    Join Date
    Aug 2008
    Posts
    77
    Thanks
    23
    Thanked 0 Times in 0 Posts
    Yes, but I want the end user to be able to do this, who doesn't have access to a command line.
    This will be done through a CMS control panel so that my clients can do their own backups.


  •  

    Tags for this Thread

    Posting Permissions

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