Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I must use tar with -T - and get backed up file list from stdin. Untoftunately when input list is empty, tar creates empty archive. I want prevention to this.

It is possible induce tar to do "Cowardly refusing to create an empty archive" instead creating empty archive with -T - option?

I know, I can examine archive is empty by simply call

tar tvF|head -n 1|grep -c ^       #we are interested in only first file exists or not

then decide remove empty or not.

But I want more elegant solution

share|improve this question

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.