Thread: Usage of tar

    #1
  1. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Posts
    698
    Rep Power
    95

    Usage of tar


    After searching for awhile I am not sure about the usage of tar. I want to create an archive that will retain its structure of directories and subdirectories. I have a directory named wordpress that contains files and well as other directories. Please tell me if this command is correct:
    tar -zcvf compress_wordpress.gz wordpress
    Usually I use the -R or -r flag for recursion. Do I need the -R flag here?
    Last edited by epanagio; July 24th, 2012 at 04:47 PM.
    Evan
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,464
    Rep Power
    1751
    If the source for the tar is a directory then that directory, plus contents will be included in the archive. Thus your syntax is correct, assuming that you will be in the correct directory when the command is issued (the directory that contains the named directory).
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc

IMN logo majestic logo threadwatch logo seochat tools logo