Answer the question
In order to leave comments, you need to log in
How to escape folder names in tar?
Good afternoon.
There is a bash script that starts archiving folders for ELK.
Folder names are generated from random characters, and when the folder starts with "-". For example "-32JUVRKW5Qx9MrF49oQ". Then tar takes the next character as an option, and crashes accordingly.
Team "
tar -cvzf $ARCHIV_DIR/$ARCHIV_DATA.tar.gz -C /srv/lib/elasticsearch/nodes/0/indices/ $INDICES
". Where $INDICES are folder names like "Bu894OCDRBWxupAuIPKrcg n1cWAfXYRvaszRwvvcN2IQ 9_9CDKEuTJ-OkXdidplEUg, Answer the question
In order to leave comments, you need to log in
tar -cvzf $ARCHIV_DIR/$ARCHIV_DATA.tar.gz -C /srv/lib/elasticsearch/nodes/0/indices/ -- $INDICES
$ tar cvf 1 -- x y -wow
x/
x/1.txt
y/
y/1.txt
-wow/
-wow/1.txt
$ tar cvf 1 x y -wow
add ‘x’?^C
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question