I'm trying to create a compressed TAR file. I have a disk that I am going to destroy and would like to take one last snapshot of the /users folder but don't want the users .m4v .m4a and .mp3 files as they are too large.
I tried using this command line
sudo tar acvf- -exclude='*.m4v' -exclude='*.m4a' -exclude='*.mp3' /home/john/Desktop/KS_UserFolders.tar.gz media/john/OS/Users/
The message that I get back is
john@Pepper:~$ sudo tar acvf- -exclude='*.m4v' -exclude='*.m4a' -exclude='*.mp3' /home/john/Desktop/KS_UserFolders.tar.gz media/john/OS/Users/
[sudo] password for john:
tar: -exclude=*.m4a: Cannot stat: No such file or directory
tar: -exclude=*.mp3: Cannot stat: No such file or directory
tar: Removing leading `/' from member names
tar: /home/john/Desktop/KS_UserFolders.tar.gz: Cannot stat: No such file or directory
tar: media/john/OS/Users: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
john@Pepper:~$
I'm sure it's just me getting used to the syntax of Linux, but I can't find a good usage example of TAR that matches my situation, and version of TAR
Try
Note that the archive file name must come right after the
f
option (without a-
), and the--exclude
options need two dashes.If you want it all on one line, it would be