user6171746
user6171746

Reputation:

create new script to tar file return error

I've create script which (under the root folder on my machine) , to create two folder and take from the root folder tar file and extract it in specified folder, the problem is that i`m getting error(not found in archive tar: Exiting with failure status due to previous errors), Im new to scripting ...

The tar is under the root

this is my script

#!/bin/bash
mkdir aa_tmp
mkdir bb_myBP

tar -xvf /home/i079900/aiab-cdi-ui-assembly.tar /home/i079900/bb_myBP
echo "success"

I want that after the folder bb_myBP is created to extract this file in the bb_myBP all folder and assets are under /home/i079900, any idea what I miss here?

the tar file is located under my user ...

Upvotes: 0

Views: 233

Answers (1)

tianwei
tianwei

Reputation: 1879

So you want to extract the files to he newly created directory bb_myBp?

tar command needs a -C argument to determine which directory to extract.

#!/bin/bash
mkdir aa_tmp
mkdir bb_myBP

tar -xvf /home/i079900/aiab-cdi-ui-assembly.tar -C 
/home/i079900/bb_myBP
echo "success"

Upvotes: 1

Related Questions