ritzz.soni
ritzz.soni

Reputation: 345

is it possible to create a tar of any file which will give different file name after untar

I have some files to tar for example
abc.php_mtime_size
now i want to TAR this file such that when I untar it will have a name "abc.php"
so is there any way by which I can specify output file name as well while creating the TAR file.

Upvotes: 0

Views: 185

Answers (2)

bbh
bbh

Reputation: 509

Try the following set/sequence of commands: assuming your original file is a.b_backup...you can try this..

$ tar -cvf test.tar a.b_backup
$ tar --transform='s/_backup//' -xf test.tar
$ ls
a.b
a.b_backup

Upvotes: 2

user12341234
user12341234

Reputation: 7213

Perhaps you should rename the file to its desired name before you tar it.

Upvotes: 1

Related Questions