Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a backup script that has this syntax "tar -czvf backup.tar.gz -T filelist" In this filelist, I'm listing folder to backup, but I also need to backup every file that has a given extension like "*.jpeg"

The file name are changing everyday, that's why I need to use a wildcard but it's not accepted in a file list.

Is there a workaround to make this work ?

Thanks !

share|improve this question

2 Answers 2

Have you try using --wildcards ?

 tar -xf foo.tar -v --wildcards '*.c'

http://www.gnu.org/s/tar/manual/html_section/wildcards.html

share|improve this answer
    
I tried and looks like --wildcards only works for extraction, doesn't work with -cf –  Bastien974 Nov 7 '11 at 14:25
up vote 1 down vote accepted

The easiest solution I found is : tar -czvf backup.tar.gz $(cat filelist)

share|improve this answer
    
This is a nice idea, but you could end up with an insanely long arguments list. Which would then cause problems with the shell. –  Tom O'Connor Nov 9 '11 at 23:31
    
What kind of problems/limitations ? –  Bastien974 Nov 17 '11 at 19:41
    
ARG_MAX -- see here : snippets.dzone.com/posts/show/2803 –  Tom O'Connor Nov 17 '11 at 20:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.