Solved cannot remove file after tar

Hi guys,

I am trying to tar and delete a file in the same command but I cannot get it to work..
Code:
tar czf $BKNAME.tar.gz $BKNAME --remove-files
Code:
tar: --remove-files: Cannot stat: No such file or directory
Could someone please point out the obvious mistake?
 
Here is the log output
Code:
+ tar -czf /usr/local/www/production/wpbackup/2016-09-28.1146-mydoamin.co.uk-sql.sql.tar.gz /usr/local/www/production/wpbackup/2016-09-28.1146-mydoamin.co.uk-sql.sql --remove-files
tar: Removing leading '/' from member names
tar: --remove-files: Cannot stat: No such file or directory
 
SirDice,
Thank you for your reply.
I tried all sort of way to get it working..
Could you please show me how to achive what I want?
I looked all over google and saw lots example using the command above.
Maybe it work in older version of tar...
 
Back
Top