Excluding certain file types from a copy command

Is it possible to copy a folder (say, a home folder) but exclude files of a certain type (ie, .mp3)?

If not in AppleScript, is there a way to incorporate this into “do shell script”?


This is easy to do in AppleScript:

tell application "Finder"
	set filesToCopy to every file of folder "Macintosh HD:source" whose name extension is not "mp3"
	duplicate filesToCopy to folder "Macintosh HD:target:"
end tell

Just change the folder definitions as appropriate. Also, if you don’t want to rely on name extensions you can use ‘file type’ instead.