'How to tar compress specific and multiple files without changing of name in Bash?
I need do some simple compresion multiple files to .tar in bash. Conditions: My archive must include only files with extension .exe. Unfortunetly, when I am trying this:
find ./myDir -name "*.exe" | tar -cf archive -T -
The file names are changed like ./file1.exe How can I compress this without change of file names?
Solution 1:[1]
Suggesting:
find "$PWD/myDir" -name "*.exe" | tar -cf archive -T -
This will not do anything interesting.
Better suggesting to feed tar command with results from find command
tar czf your_compressed_file.tar.gz $(find ./myDir -name "*.exe")
Notice tar cf is not compressed. But tar czf is compressed.
You can also add -v option to see what are the compressed files:
tar czfv your_compressed_file.tar.gz $(find ./myDir -name "*.exe")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
