Tar file

I need to create a tar file by taking my scripts from different directories.

Also once I created the tar file, if I need to append some more files from different directories what is the command I need to use.

Can some one help me please

You can use rvf option to append files or new directories.

Thanks.

Can you tell me how to create a tar file my taking scripts from different directories.

Also help how to untar it

First read the man pages

man tar

Then try to apply it on some test data.
And come back with specific questions.

cd /path/test/scripts
I have a file test.sh inside this path
cd /path/test
I have another file test1.sh inside this path

Currently I am in /path/test/scripts path

I am doing something like this

tar cvf output_filename.tar test.sh /path/test/test1.sh

AT that time its giving me a error like this
tar: Removing leading `/' from member names and when I untar it , its going and create the directory /path/test/

That's not an error, it's a notice.

TAR won't add a file with its absolute. That's a good thing that could save your skin one day!

1 Like

So true :b: :smiley:

But why its going and creating the directory again even though the directory is there.the particular file should go to the particular path while untar it

It can't create a directory if it's already there. It will create a directory wherever you are at the time to extract the TAR file.

All paths in the TAR file are relative to your current working directory.

./test.sh
./path/test/test1.sh
etc.

(the stuff in red is implied)
You need to be in the right place when you extract it.