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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:21:11+00:00 2026-05-23T15:21:11+00:00

In a mono exe I am creating .sh scripts file containing codes as below

  • 0

In a mono exe I am creating .sh scripts file containing codes as below

tarcreator.sh:

tar -cvf /data/folder1/folder2/.../xyz.tar /data/...../tarHomeFolder/myTarFolder > /data/logs/tarLogs.txt 

….
and the codes continue.

this .sh file is located in /data/…../tarHomeFolder and in my .exe I call it using “bash ‘full path of .sh file'”

When I run this code in this way, it creates the tar but when I open the tar I see folders from the root directory.. (data/…./tarHomeFolder/myTarFolder/…..) instead of this I want my tar contain only directory structure of its folder (myTarFolder).

Then I changed the code to :

tar -cvf /data/folder1/folder2/.../xyz.tar myTarFolder > /data/logs/tarLogs.txt 

knowing that .sh file is in tarHomeFolder but then my script tells no such file or directory for myTarFolder ..

when I use tar command right in command prompt, using the command

tar -cvf /data/folder1/folder2/.../xyz.tar myTarFolder > /data/logs/tarLogs.txt 

it creates the tar directory structure as I want, so, how can I make it do the same in my bash file created and executed by mono .exe ?

  • 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-23T15:21:12+00:00Added an answer on May 23, 2026 at 3:21 pm

    All you need to do is change your directory before running tar. Something like this:

    # If your full path to the directory is in DIR = "/data/...../tarHomeFolder/myTarFolder"
    cd $(dirname $DIR)
    tar -cvf /data/folder1/folder2/.../xyz.tar $(basename $DIR) > /data/logs/tarLogs.txt 
    

    This will leave you with relative paths, starting with myTarFolder, in your tar file.

    Useful references:

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

Sidebar

Related Questions

I'd like to embed Mono into an .exe file but the problem is the
As we can execute such executables in two ways, such as sudo mono test.exe,
I can run example.exe from Terminal( mono example.exe).And I can not do this through
I can open Terminal and write mono example.exe, but I want to double click
I ran a mono-service with mono-service2 -l:lockfile process.exe It started the service and it
Running Nant -v on mono gives informs me it uses gmcs.exe (C# 2.0). Starting
I registered Mono.WebServer.dll in the GAC with: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe Then I
It seem Mono ignores dllmaps in the local configuration file. I want to port
I have a .Net program, which works fine using mono Program.exe, but now I
I use Antlr tools as follows (on Mono) dmcs /r:Antlr3.Runtime.dll /r:StringTemplate.dll *.cs /out:Main.exe 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.