I want to tar all the *.txt files that I get as the result of a find command, that exist in a directory having a tree structure like this:
- Directory_name
- dir1
- file1.pdf
- file1.txt
- dir2
- file2.pdf
- file2.txt
- dir3
- file3.pdf
- file3.txt
(the filenames are just examples).
But I want to preserve the directory structure.
What command can give me a tar.gz file with this content?
- dir1
- file1.txt
- dir2
- file2.txt
- dir3
- file3.txt