Thread: Usage of tar

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

    Join Date
    Nov 2003
    Rep Power

    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.
  2. #2
  3. Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2006
    Rep Power
    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