8

How to create a tar.gz without all the folders

view full story
linux-howto

http://stackoverflow.com – Okay, so what I want to do (in ubuntu server 12.04) is take all the directories in the "servers" folder and create a tar.gz of all of them individually. For example: Inside the servers folder are 3 more folders. Server1, server2 and server3. I want to compress in a tar.gz the contents of server1, server2, and server3. So in the server1 folder, I have a test.txt file. I want that to be the only thing inside the server.tar.gz. Heres the code I have so far in bash servers=(servers/*) for i in "${servers[@]}" do NAME=${i:8} <-- to trim off the /servers/ part of /servers/servernumber tar -C (HowTos)