Page 2 of 2 FirstFirst 12
Results 11 to 11 of 11

Thread: Archiving only dot directories (+sub-diectories) and files in home directory

  1. #11
    Join Date
    Jan 2012
    Beans
    342

    Re: Archiving only dot directories (+sub-diectories) and files in home directory

    I would generally want all the files contained in the tarball to be in a directory, and for that reason would use tar from /home ...

    Code:
    % cd /home
    % tar cjf /path/to/backup/archive-$(date +%F).tar.bz2 username

    The point to keep in mind with tar is that it is an archive of the target path, so /home/username will contain a 'deeper' directory structure than "." .. this can have repercusions if/when you untar the archive.

    There are many way to read the content of the archive, 'tar ztvf archive.tar.gz', or using less (with lesspipe.sh) but people often overwrite files and/or end up with files strewn in unwated places (hence the '-w' switch).

    Also useful ... send the data directly to another machine (tar over ssh)

    Code:
    tar cjf - username | ssh user@host.tld "cat > /path/to/archive-$(date +%F).tar.bz2"
    I find rsync much more flexable for this sort of thing and so rarely make backups of this sort.

    HTH ... khay




    Last edited by Khayyam; February 29th, 2012 at 03:29 AM.

Page 2 of 2 FirstFirst 12

Tags for this Thread

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
  •