Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View backup contents and restore specific file or directory #13

Open
alexandreteles opened this issue Dec 8, 2014 · 0 comments
Open

Comments

@alexandreteles
Copy link
Contributor

Please, make CDP provide a way to see the files inside backups and restore backups in a per file/dir way Ex.: I want to see if /etc/any.conf exists and restore it to the original node or for other.

Tar provides a way to list all files inside a tarball. You can find it at tar man(1) doc:

tar -tvf archive.tar
# List all files in archive.tar verbosely.

This should work for compressed files as well. Just put the flag that matches the compression algorithm that you have used:

$ tar -ztvf sometarfile.tar.gz

or

$ tar -jtvf sometarfile.tar.bz2

or any other algorithm.

If you are compressing with gzip or just putting files together without compressing it, you can use less:

$ less sometarfile.tar.gz

Less provides a very graceful output, just like ls -l. And tar does have a function to pull just one file or directory from one archive too:

$ tar -zxvf sometarfile.tar.gz somedir/subdir/justafile

If you want to pull a dir you just use the same command but point to the dir path inside the tar file. Note that you dont use a / at the beginning of the internat tar dir path:

$ tar -zxvf sometarfile.tar.gz somedir/subdir/

This works for any compression algo. used to compress the tarball. You can extract all files that match a wildcard inside the tar file:

tar -zxvf sometarfile.tar.gz --wildcards --no-anchored '*.conf'

Or the same wildcard inside a specific dir:

tar -zxvf sometarfile.tar.gz somedir/subdir/ --wildcards '*.conf'

Thank you for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant