Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8446409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:55:30+00:00 2026-06-10T09:55:30+00:00

I have to compress multiple files to one tar-File. As I have to repeat

  • 0

I have to compress multiple files to one tar-File. As I have to repeat this for many files in many different folders I wrote a shell script and started it from a parent directory. The shell script contains multiple lines like the following:

tar -cf a/b/c/tarfile.tar a/b/c/*

This creates a tar-file in the specified folder but inside the tar-File the folder structure of a/b/c/ is still existent.

What I want is that all files in c/ are placed in tarfile.tar WITHOUT the folder structure a/b/c/. Is this possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T09:55:32+00:00Added an answer on June 10, 2026 at 9:55 am

    tar -cf a/b/c/tarfile.tar -C a/b/c . will switch to the directory a/b/c and read in the entire directory (the . – you could specify specific files as well, but a wildcard will not do what you’re expecting). The -C <directory> <filelist> pattern can be repeated as necessary to process additional files from different locations.

    Another possibility given your original example would be cd a/b/c; tar cf ../../../tarfile.tar *, but that doesn’t give you the possibility to pull multiple files from different locations (of course you could still use -C, but the relative paths would have to be adjusted accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to compress multiple files into one zip. I am stuck with this
I have seen many tutorials on how to compress a single file in c#.
I have found this code to make php file cache and compress. Below is
I want to compress the files in ruby. for example I have file: base_1.txt
I have tried multiple ways to create this zip file in Java/Groovy. The first
I have a crontab the compress log files. In crontab -e I have -I'm
I have around 2 million strings with different lengths that I need to compress
How can i compress and image file(*bmp,*jpeg) in C#, I have to display some
I have an script that will show some compress options to the user (gzip,
I have a function where I will compress a bunch of files into a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.