Is possible to remove âon flyâ the full path using tar?
Clash Royale CLAN TAG#URR8PPP
up vote
-1
down vote
favorite
I have some mp3 on various dir.
I did
find $HOME -name *.mp3|pax -wf arch.tar
The command works fine,but when extract, it recreate the full dirs
for example
tar -tvf arch.tar
Return
dir1/dir2/sound.mp3
dir3/music.mp3
dir4/dir5/anotherdir/anothermusic.mp3
When extract of course will create a lot of dirs.
My desire is a thing like this
find $HOME -name *.mp3|pax -w"possibleoption" -f arch.tar
To obtain an archive like this
/sound.mp3
/music.mp3
/anothermusic.mp3
I know is not safe,but is possible to strip dir path on fly?
p.s= I used pax command for example, but the classical tar is also good
tar pax
add a comment |Â
up vote
-1
down vote
favorite
I have some mp3 on various dir.
I did
find $HOME -name *.mp3|pax -wf arch.tar
The command works fine,but when extract, it recreate the full dirs
for example
tar -tvf arch.tar
Return
dir1/dir2/sound.mp3
dir3/music.mp3
dir4/dir5/anotherdir/anothermusic.mp3
When extract of course will create a lot of dirs.
My desire is a thing like this
find $HOME -name *.mp3|pax -w"possibleoption" -f arch.tar
To obtain an archive like this
/sound.mp3
/music.mp3
/anothermusic.mp3
I know is not safe,but is possible to strip dir path on fly?
p.s= I used pax command for example, but the classical tar is also good
tar pax
1
Please look on this stackoverflow.com/questions/14295771/â¦
â mariaczi
Apr 10 at 11:10
Add as answer,if none put a better answer I can vote as solution
â elbarna
Apr 10 at 11:25
add a comment |Â
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I have some mp3 on various dir.
I did
find $HOME -name *.mp3|pax -wf arch.tar
The command works fine,but when extract, it recreate the full dirs
for example
tar -tvf arch.tar
Return
dir1/dir2/sound.mp3
dir3/music.mp3
dir4/dir5/anotherdir/anothermusic.mp3
When extract of course will create a lot of dirs.
My desire is a thing like this
find $HOME -name *.mp3|pax -w"possibleoption" -f arch.tar
To obtain an archive like this
/sound.mp3
/music.mp3
/anothermusic.mp3
I know is not safe,but is possible to strip dir path on fly?
p.s= I used pax command for example, but the classical tar is also good
tar pax
I have some mp3 on various dir.
I did
find $HOME -name *.mp3|pax -wf arch.tar
The command works fine,but when extract, it recreate the full dirs
for example
tar -tvf arch.tar
Return
dir1/dir2/sound.mp3
dir3/music.mp3
dir4/dir5/anotherdir/anothermusic.mp3
When extract of course will create a lot of dirs.
My desire is a thing like this
find $HOME -name *.mp3|pax -w"possibleoption" -f arch.tar
To obtain an archive like this
/sound.mp3
/music.mp3
/anothermusic.mp3
I know is not safe,but is possible to strip dir path on fly?
p.s= I used pax command for example, but the classical tar is also good
tar pax
asked Apr 10 at 11:06
elbarna
3,76893477
3,76893477
1
Please look on this stackoverflow.com/questions/14295771/â¦
â mariaczi
Apr 10 at 11:10
Add as answer,if none put a better answer I can vote as solution
â elbarna
Apr 10 at 11:25
add a comment |Â
1
Please look on this stackoverflow.com/questions/14295771/â¦
â mariaczi
Apr 10 at 11:10
Add as answer,if none put a better answer I can vote as solution
â elbarna
Apr 10 at 11:25
1
1
Please look on this stackoverflow.com/questions/14295771/â¦
â mariaczi
Apr 10 at 11:10
Please look on this stackoverflow.com/questions/14295771/â¦
â mariaczi
Apr 10 at 11:10
Add as answer,if none put a better answer I can vote as solution
â elbarna
Apr 10 at 11:25
Add as answer,if none put a better answer I can vote as solution
â elbarna
Apr 10 at 11:25
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
These variations all assume that you've created an archive with the original path stored in the archive itself. They transform the path when listing/extracting the archive.
Using pax
with its -s
flag:
pax -f archive.tar -s '@.*/@/@' '*.mp3'
Add -r
at the start to actually extract the files.
With BSD tar
:
tar -tf archive.tar -s '@.*/@/@' '*.mp3'
Change -t
to -x
to actually extract the files.
With GNU tar
:
tar -tPf archive.tar --transform 's@.*/@/@' --show-transformed-names --wildcards '*.mp3'
Change -t
to -x
to actually extract the files.
The string replacement will remove the path stored in the archive and replace it with a single /
.
The equivalent operation for creating an archive with files whose pathnames are read from standard input (transforming the names by replacing the path with /
):
pax
:
pax -w -f archive.tar -s '@.*/@/@'
BSD tar
:
tar -c -f archive.tar -s '@.*/@/@'
GNU tar
:
tar -c -f archive.tar --transform='s@.*/@/@' --files-from=-
pax works fine with find,tar give error if read from stdin with those options
â elbarna
Apr 10 at 12:30
@elbarna See updated answer.
â Kusalananda
Apr 10 at 12:49
Ok,perfect,voted as solution
â elbarna
Apr 10 at 14:05
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
These variations all assume that you've created an archive with the original path stored in the archive itself. They transform the path when listing/extracting the archive.
Using pax
with its -s
flag:
pax -f archive.tar -s '@.*/@/@' '*.mp3'
Add -r
at the start to actually extract the files.
With BSD tar
:
tar -tf archive.tar -s '@.*/@/@' '*.mp3'
Change -t
to -x
to actually extract the files.
With GNU tar
:
tar -tPf archive.tar --transform 's@.*/@/@' --show-transformed-names --wildcards '*.mp3'
Change -t
to -x
to actually extract the files.
The string replacement will remove the path stored in the archive and replace it with a single /
.
The equivalent operation for creating an archive with files whose pathnames are read from standard input (transforming the names by replacing the path with /
):
pax
:
pax -w -f archive.tar -s '@.*/@/@'
BSD tar
:
tar -c -f archive.tar -s '@.*/@/@'
GNU tar
:
tar -c -f archive.tar --transform='s@.*/@/@' --files-from=-
pax works fine with find,tar give error if read from stdin with those options
â elbarna
Apr 10 at 12:30
@elbarna See updated answer.
â Kusalananda
Apr 10 at 12:49
Ok,perfect,voted as solution
â elbarna
Apr 10 at 14:05
add a comment |Â
up vote
3
down vote
accepted
These variations all assume that you've created an archive with the original path stored in the archive itself. They transform the path when listing/extracting the archive.
Using pax
with its -s
flag:
pax -f archive.tar -s '@.*/@/@' '*.mp3'
Add -r
at the start to actually extract the files.
With BSD tar
:
tar -tf archive.tar -s '@.*/@/@' '*.mp3'
Change -t
to -x
to actually extract the files.
With GNU tar
:
tar -tPf archive.tar --transform 's@.*/@/@' --show-transformed-names --wildcards '*.mp3'
Change -t
to -x
to actually extract the files.
The string replacement will remove the path stored in the archive and replace it with a single /
.
The equivalent operation for creating an archive with files whose pathnames are read from standard input (transforming the names by replacing the path with /
):
pax
:
pax -w -f archive.tar -s '@.*/@/@'
BSD tar
:
tar -c -f archive.tar -s '@.*/@/@'
GNU tar
:
tar -c -f archive.tar --transform='s@.*/@/@' --files-from=-
pax works fine with find,tar give error if read from stdin with those options
â elbarna
Apr 10 at 12:30
@elbarna See updated answer.
â Kusalananda
Apr 10 at 12:49
Ok,perfect,voted as solution
â elbarna
Apr 10 at 14:05
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
These variations all assume that you've created an archive with the original path stored in the archive itself. They transform the path when listing/extracting the archive.
Using pax
with its -s
flag:
pax -f archive.tar -s '@.*/@/@' '*.mp3'
Add -r
at the start to actually extract the files.
With BSD tar
:
tar -tf archive.tar -s '@.*/@/@' '*.mp3'
Change -t
to -x
to actually extract the files.
With GNU tar
:
tar -tPf archive.tar --transform 's@.*/@/@' --show-transformed-names --wildcards '*.mp3'
Change -t
to -x
to actually extract the files.
The string replacement will remove the path stored in the archive and replace it with a single /
.
The equivalent operation for creating an archive with files whose pathnames are read from standard input (transforming the names by replacing the path with /
):
pax
:
pax -w -f archive.tar -s '@.*/@/@'
BSD tar
:
tar -c -f archive.tar -s '@.*/@/@'
GNU tar
:
tar -c -f archive.tar --transform='s@.*/@/@' --files-from=-
These variations all assume that you've created an archive with the original path stored in the archive itself. They transform the path when listing/extracting the archive.
Using pax
with its -s
flag:
pax -f archive.tar -s '@.*/@/@' '*.mp3'
Add -r
at the start to actually extract the files.
With BSD tar
:
tar -tf archive.tar -s '@.*/@/@' '*.mp3'
Change -t
to -x
to actually extract the files.
With GNU tar
:
tar -tPf archive.tar --transform 's@.*/@/@' --show-transformed-names --wildcards '*.mp3'
Change -t
to -x
to actually extract the files.
The string replacement will remove the path stored in the archive and replace it with a single /
.
The equivalent operation for creating an archive with files whose pathnames are read from standard input (transforming the names by replacing the path with /
):
pax
:
pax -w -f archive.tar -s '@.*/@/@'
BSD tar
:
tar -c -f archive.tar -s '@.*/@/@'
GNU tar
:
tar -c -f archive.tar --transform='s@.*/@/@' --files-from=-
edited Apr 10 at 13:09
answered Apr 10 at 11:27
Kusalananda
102k13200317
102k13200317
pax works fine with find,tar give error if read from stdin with those options
â elbarna
Apr 10 at 12:30
@elbarna See updated answer.
â Kusalananda
Apr 10 at 12:49
Ok,perfect,voted as solution
â elbarna
Apr 10 at 14:05
add a comment |Â
pax works fine with find,tar give error if read from stdin with those options
â elbarna
Apr 10 at 12:30
@elbarna See updated answer.
â Kusalananda
Apr 10 at 12:49
Ok,perfect,voted as solution
â elbarna
Apr 10 at 14:05
pax works fine with find,tar give error if read from stdin with those options
â elbarna
Apr 10 at 12:30
pax works fine with find,tar give error if read from stdin with those options
â elbarna
Apr 10 at 12:30
@elbarna See updated answer.
â Kusalananda
Apr 10 at 12:49
@elbarna See updated answer.
â Kusalananda
Apr 10 at 12:49
Ok,perfect,voted as solution
â elbarna
Apr 10 at 14:05
Ok,perfect,voted as solution
â elbarna
Apr 10 at 14:05
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f436747%2fis-possible-to-remove-on-fly-the-full-path-using-tar%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Please look on this stackoverflow.com/questions/14295771/â¦
â mariaczi
Apr 10 at 11:10
Add as answer,if none put a better answer I can vote as solution
â elbarna
Apr 10 at 11:25