Create a tar archive called directory.tar
of directory/
excluding the directory/backups
and directory/dist
directories.
You can use this short tar command.
tar --exclude directory/backups/ --exclude directory/dist/ -cvf directory.tar directory/
Or this more verbose tar command.
tar --exclude directory/backups/ --exclude directory/dist/ --create --verbose --file directory.tar directory/
--exclude
tells tar not to process files or directories that match the specified pattern-c
or --create
tells tar to create a new archivev
or --verbose
tells tar to produce verbose outputf
or --file
tells tar that the next parameter will be the tar file to create, extract, append to, list, etc.