Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Following command sudo tar jcf /datos/backup/news/news.tar.bz2 -C /var/www/news news is giving "tar: Cann't stat: No such file or directory" error.

How can I solve this problem?

As it had been answered in my previous question I am using -C option in order to skip leading directories. It was working in one Ubuntu server and now in my Ubuntu Desktop it is giving that error message.

share|improve this question

3 Answers 3

up vote 1 down vote accepted

If you are using -C that means you are changing directory there. Hence, if you want to tar a directory named news in /var/www you must use:

sudo tar jcf /datos/backup/news/news.tar.bz2 -C /var/www/ news
share|improve this answer

Alternatively you can execute your as follows:

(cd /var/www/news ; tar -jcf /datos/backup/news/news.tar.bz2 news)

This should create the archive /datos/backup/news/news.tar.bz2 with the content news. This requires, that the folder /var/www/news/news exists. If you intended to compress the folter /var/www/news only, use instead:

sudo tar jcf -C /var/www /datos/backup/news/news.tar.bz2 news

or

(cd /var/www ; tar -jcf /datos/backup/news/news.tar.bz2 news)
share|improve this answer

Do you have a news directory inside /var/www/news?

If not you could replace the last news with a . eg.:

sudo tar jcf /datos/backup/news/news.tar.bz2 -C /var/www/news .
share|improve this answer

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.