How to store complete path using 7z on linux

  • Stephen

    Stephen - 2013-09-03

    I am looking for a simple way to backup files that have changed in the last 24 hours and creating a daily 7zip file ( I don't need permssion or users just files ).

    Using the following command I can pass a list of changed file to 7Zip, and this works well. However no path information of the changed files is stored in 7zip.

    /usr/bin/find /local-storage/public_html/ -type f -size -25M -mtime -1 -print | /usr/bin/xargs -n 1 /usr/bin/7z a -t7z -m0=lzma -mx=9 /local-storage/public_html_2013-09-03.7z

    So if I now try to extract that 7zip file it is all just in 1 directory and no paths.

    Hoping someone here can point out what I have missed :-)

  • Patrik Nilsson

    Patrik Nilsson - 2013-09-06

    cd /
    /usr/bin/find local-storage/public_html/ -type f -size -25M -mtime -1 -print | /usr/bin/xargs -n 1 /usr/bin/7z a -w/tmp -t7z -m0=lzma -mx=9 /local-storage/public_html_2013-09-03.7z

    If you use a relative path adding your files the full path is stored. Working directory must be set. Tested on 9.20 Debian.

    Last edit: Patrik Nilsson 2013-09-06

Log in to post a comment.