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 6623859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:34:58+00:00 2026-05-25T21:34:58+00:00

sample setup: folder structure /folder1/folder2/folder3 folder3 has 2 files: sample.backups.tar sample My objective to

  • 0

sample setup: folder structure

/folder1/folder2/folder3

folder3 has 2 files:

  • sample.backups.tar
  • sample

My objective to run a script that bzips sample and appends it to sample.backups.tar, remove the compressed file outside bzip.

I wrote the following lines

folder3Path=#full path for folder3
samplePath=#full path with file name for sample file
compressedSamplePath=#full path with file name for bzipped sample file to be created
sampleBackupsPath=#full path with file name for sample.backups.tar

tar -jcf $compressedPath sample
tar -r --file=$sampleBackupsPath $compressedSamplePath --remove-files

The result was that inside sample.backups.tar I have the file structure /folder1/folder2/folder3/sample.tar.bz2.

I don’t want the folder structure there; I want only sample.tar.bz2 to be in that file, without the folders. How would I accomplish that?

Things tried:

tar -jcf $compressedPath sample
tar -C $folder3Path -r --file=$sampleBackupsPath $compressedSamplePath --remove-file

Attempted to change the folder to compressed sample file, but it still gives me the folder structure

Note:

For the requirement I have, I need to use absolute and full paths for all name references.
I am using append mode for tar as I need to use the same tar to store multiple bzips.

  • 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-05-25T21:34:58+00:00Added an answer on May 25, 2026 at 9:34 pm
    `tar -C $folder3Path -jcf $compressedSamplePath sample`
    `tar -C $folder3Path -r --file=$sampleBackupsPath $compressedSampleName`
    `rm $compressedSamplePath`
    

    I ended up solving the problem in the above fashion, but I dont understand why the following would not work.

    `tar -C $folder3Path -r --file=$sampleBackupsPath $compressedSampleName --remove-files`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to setup NACHOS java version in Linux and run some simple sample
I have a folder that has the spring libraries. I have a separate folder
I have a very simple Setup project that copies three dlls into the GAC.
I need to setup a simple IVR system for a friend's company that will
Is there a simple way to setup different .gitignore files for different remotes? I
I'm trying to setup a simple timer that gets started from a Rails Application.
I am attempting to install libxml2 so that I can setup the python bindings
I have a simple single page setup. Under a root folder, I have 3
We have a setup project that currently adds Project Output's from different visual studio
I have a simple WCF service setup that uses JSON. In this service I

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.