Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 5982  / 2 Years ago, fri, november 26, 2021, 3:38:17

I am archiving a folder using following command:



tar jcf "home/username/forum/forum.tar.bz2" /var/www/forum/


Then I am extracting using :



tar jxf forum.tar.bz2 ./


It extracts correctly, but creates /home/username/forum/var/www/forum folder. What do I need to do in order to extract it into /home/username/forum folder?



Thank you


More From » server

 Answers
4

When creating the archive use -C /var/www/ to change the current directory to /var/www while creating the archive.



tar jcf home/username/forum/forum.tar.bz2 -C /var/www/ forum


This will cause the 'forum' folder to be in the top level of the archive and will therefore extract directly into the current folder when you run:



tar jxf forum.tar.bz2 ./

[#43629] Saturday, November 27, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kilusy

Total Points: 171
Total Questions: 110
Total Answers: 128

Location: Cayman Islands
Member since Sat, Dec 5, 2020
3 Years ago
;