tar behaves weird

Hi,
I am using a Backup Script which should take all data in one folder together and makes this to an archive.

For this I am using: [cmd=]tar -czf /media/data /media/backup[/cmd]
The problem now is that I always am getting some weird "error" messages.
I don't now whats going wrong here

Code:
tar -cfv /media/backup/1.tar.gz /media/data
tar: /media/backup/1.tar.gz: Cannot stat: No such file or directory
tar: Removing leading '/' from member names
 
Tar is very picky about the order of the options. The file name *MUST* come right after -f.

The command you listed will create a tarfile called v and try to add the /media/backup/1.tar.gz file and /media/data directory to it.

Try the following:
# tar -zcvf /media/backup/1.tar.gz /media/data
Note the addition of the -z to compress it, and moving the -v in front of -f.
 
Ah, thank you :D
Now it works ;)

I mentioned that the syntax under FreeBSD is kept very strict unlike as under GNU/Linux.
What reason does this have?

Regards
 
Read the man page. The behaviour of tar changes depending on whether or not you use - in front of the options. As in, -zxvf is not the same as zxvf.
 
Back
Top