Avatar of oconnork00
oconnork00Flag for United States of America

asked on 

How to Tar folder contents

Hi all,

I am a total noob to this so bear with me please.

What I would like to do is to tar a folder's contents to newfolder.tar

But I wont want to tar the folder also.

For example,

Using normal zip I would zip folder1 to folder1.zip
WHen extracting I would also have folder1 in theextraction and then inside that folder the contents.

I would need to just tar the contents of folder1 and not folder1 itself.

Could you explain to me the tar command to do this, and then the tar command to untar this.

Thanks in advance experts,

Kevin


Linux

Avatar of undefined
Last Comment
oconnork00
ASKER CERTIFIED SOLUTION
Avatar of WizRd-Linux
WizRd-Linux
Flag of Australia image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of oconnork00
oconnork00
Flag of United States of America image

ASKER

If I had a folder in c:\docs and inside that folderwere two files, file1.doc and file2.doc

I want to tar these two doc files together as one tar so that when I untar them later the two files will just tar to the c:\ (for example) or the root.

Will the command you gave do this?

Thanks,

Kevin

Avatar of WizRd-Linux
WizRd-Linux
Flag of Australia image

yes it definately will.  If you specifically wanted to just tar up specific files with the same extension, change * on the compression line to *.doc or similar.

One the uncompression, instead of . you can replace this with a specific folder.
Avatar of oconnork00
oconnork00
Flag of United States of America image

ASKER

Thanks, just what I needed.
Linux
Linux

Linux is a UNIX-like open source operating system with hundreds of distinct distributions, including: Fedora, openSUSE, Ubuntu, Debian, Slackware, Gentoo, CentOS, and Arch Linux. Linux is generally associated with web and database servers, but has become popular in many niche industries and applications.

71K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo