I want to extract website.tgz but I don't want these to "come out":
app/config.ini
log/
How do I do this?
Or/also how do I overwrite everything except the above?
Now, if you want a single file or folder from the “tar” file, you need to use the name of the “tar” file and the path to a single file in it. So, we have used the “tar” command with the “-xvf” option, the name of the “tar” file, and the path of a file to be extracted from it as below.
You can exclude directories with --exclude for tar. To clarify, you can use full path for --exclude. Beware that --exclude=dir/ignore_this_dir will match in any subtree as well! You'll end up missing files you didn't expect to be excluded.
The ' --exclude= pattern ' option prevents any file or member whose name matches the shell wildcard ( pattern ) from being operated on. For example, to create an archive with all the contents of the directory 'src' except for files whose names end in '.o', use the command ' tar -cf src. tar --exclude='*.o' src '.
Try using the following command
tar -xvzf /path/to/tarfile --exclude='file dont want to extract'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With