Ubuntu – Why I get “Cowardly refusing to create an empty archive” with TAR command

12.04command linetar

I'm trying to follow this tutorial to full backup my linux / Ubuntu 12.04 after a fresh restore.

my code in fullserver.sh:

tar -cvpf /backups/fullbackup.tar --directory=/ --exclude=proc
--exclude=sys --exclude=dev/pts --exclude=backups .

gives after executing ./backups/fullserver.sh the following error:

tar: Cowardly refusing to create an empty archive Try `tar --help' or `tar --usage' for more information. 
./backups/fullserver.sh: line 2: --exclude=sys: command not found

Any help to resolve this issue? I read somewhere that I have to remove "/" from the tar line, but I'm not sure that this is true…

Best Answer

The command should be just one line:

tar -cvpf /backups/fullbackup.tar --directory=/ --exclude=proc --exclude=sys --exclude=dev/pts --exclude=backups .

It seems you've split it into two lines.