tar directory and exclude multiple subdirectories

Clash Royale CLAN TAG#URR8PPP
up vote
-2
down vote
favorite
I'm trying to tar a whole directory except some subdirs..
The dir my-base-dir is zipped but the excluded dirs/files are also included?
tar -cf my-base-dir/bak/site/site.tar my-base-dir --exclude=my-base-dir/bak/db/* --exclude=my-base-dir/bak/site/*
The excluded paths are correct relative to the current working dir.. Because the output tar file is put in one of them
linux tar
add a comment |
up vote
-2
down vote
favorite
I'm trying to tar a whole directory except some subdirs..
The dir my-base-dir is zipped but the excluded dirs/files are also included?
tar -cf my-base-dir/bak/site/site.tar my-base-dir --exclude=my-base-dir/bak/db/* --exclude=my-base-dir/bak/site/*
The excluded paths are correct relative to the current working dir.. Because the output tar file is put in one of them
linux tar
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
I'm trying to tar a whole directory except some subdirs..
The dir my-base-dir is zipped but the excluded dirs/files are also included?
tar -cf my-base-dir/bak/site/site.tar my-base-dir --exclude=my-base-dir/bak/db/* --exclude=my-base-dir/bak/site/*
The excluded paths are correct relative to the current working dir.. Because the output tar file is put in one of them
linux tar
I'm trying to tar a whole directory except some subdirs..
The dir my-base-dir is zipped but the excluded dirs/files are also included?
tar -cf my-base-dir/bak/site/site.tar my-base-dir --exclude=my-base-dir/bak/db/* --exclude=my-base-dir/bak/site/*
The excluded paths are correct relative to the current working dir.. Because the output tar file is put in one of them
linux tar
linux tar
edited 2 days ago
asked 2 days ago
clarkk
51941122
51941122
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
You have to put --exclude option before source and destination.i.e.
tar --exclude='my-base-dir/bak/db/*' --exclude='my-base-dir/bak/site/*' -cf my-base-dir/bak/site/site.tar my-base-dir
or you can also use:
tar -cf my-base-dir/bak/site/site.tar --exclude='my-base-dir/bak/db/*' --exclude='my-base-dir/bak/site/*' my-base-dir
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
You have to put --exclude option before source and destination.i.e.
tar --exclude='my-base-dir/bak/db/*' --exclude='my-base-dir/bak/site/*' -cf my-base-dir/bak/site/site.tar my-base-dir
or you can also use:
tar -cf my-base-dir/bak/site/site.tar --exclude='my-base-dir/bak/db/*' --exclude='my-base-dir/bak/site/*' my-base-dir
add a comment |
up vote
2
down vote
accepted
You have to put --exclude option before source and destination.i.e.
tar --exclude='my-base-dir/bak/db/*' --exclude='my-base-dir/bak/site/*' -cf my-base-dir/bak/site/site.tar my-base-dir
or you can also use:
tar -cf my-base-dir/bak/site/site.tar --exclude='my-base-dir/bak/db/*' --exclude='my-base-dir/bak/site/*' my-base-dir
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
You have to put --exclude option before source and destination.i.e.
tar --exclude='my-base-dir/bak/db/*' --exclude='my-base-dir/bak/site/*' -cf my-base-dir/bak/site/site.tar my-base-dir
or you can also use:
tar -cf my-base-dir/bak/site/site.tar --exclude='my-base-dir/bak/db/*' --exclude='my-base-dir/bak/site/*' my-base-dir
You have to put --exclude option before source and destination.i.e.
tar --exclude='my-base-dir/bak/db/*' --exclude='my-base-dir/bak/site/*' -cf my-base-dir/bak/site/site.tar my-base-dir
or you can also use:
tar -cf my-base-dir/bak/site/site.tar --exclude='my-base-dir/bak/db/*' --exclude='my-base-dir/bak/site/*' my-base-dir
edited 2 days ago
answered 2 days ago
Debian_yadav
1,1653922
1,1653922
add a comment |
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f481993%2ftar-directory-and-exclude-multiple-subdirectories%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown