Find the answer to your Linux question:
Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Exclamation How do I compress a directory?


    Hey guys I was wondering how would I gzip 7z tar or just regular zip a directory like this /var/Backups/Tones regular gzip won't do it because Tones is a directory and this site ss64.com/bash doesn't really tell much and I've searched google but what those people are talking about is computer based not mobile and I'd like to also make the archive password protected if its possible!

    I've got this my problem is now is that it isn't creating a password for the archive any ideas/suggestions?

    Code:
    #!/bin/bash
    cd /var/Backups
    7z a -p{xd7@9#25ad$k} Tones.tar.7z
    
    if 7z q -p{xd7@9#25ad$k} Tones.tar.7z Tones.tar; then
    * rm Tones.tar
    fi
    
    exit 0
    Last edited by Death2020; 07-03-2012 at 06:02 PM.

  2. #2
    how about something like this?

    Code:
    cd /var/Backups
    zip --encrypt Tones.zip Tones/*

  3. #3
    Is there a way I can create my own password for this that way when it gets archived it already has a set default password?

  4. $spacer_open
    $spacer_close
  5. #4
    Quote Originally Posted by Death2020 View Post
    Is there a way I can create my own password for this that way when it gets archived it already has a set default password?
    i don't follow...it prompts you to enter a password when you say "zip --encrypt"

  6. #5
    I know that but I want it to enter the password automatically for when the zip gets created it don't ask the user to create the password

  7. #6
    Quote Originally Posted by Death2020 View Post
    I know that but I want it to enter the password automatically for when the zip gets created it don't ask the user to create the password
    it is insecure, but you can pass it as a command line argument, e.g.:

    Code:
    zip -P testpassword foo.zip /path/to/file

Posting Permissions

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