To backup everything in the current directory, exclude anything ending with jpg:
tar cvf mybackup.tar --exclude "*.jpg" .
To exclude more than one type, just add another –exclude statement:
tar cvf mybackup.tar --exclude ".jpg" --exclude ".gif" .
Search current directory and sub directories for mp3 files:
find . -name *mp3
Need to Learn: how to get the total size of the files returned by the above search command
Those were on RHEL, not aix – they will work for a lamp instance. With AIX we have to consult the man tar page.
This should work:
find . ! -name “*.mp3” > inputfilelist
tar -cvf mybackup.tar -L inputfilelist
This should also work (in the opposite direction):
find . -name “*.mp3” > excludefilelist
tar -cvf mybackup.tar -X excludefilelist .
In either case, you can use this to see if there are any mp3 files in the archive:
tar -tvf mybackup.tar | grep mp3