[X-Unix] Re: cp question

Timothy Luoma lists at tntluoma.com
Thu Feb 24 14:34:22 PST 2005


On Feb 24, 2005, at 5:01 PM, Russell McGaha wrote:

> Folks;
> 	I've got a question about how to only copy certain files of a folder 
> [more accurately to not copy].
> 	I've a 10.2.8 system [so I'll be using tsch] that I need to copy the 
> files in one director to another directory; this is no problem, BUT I 
> need to EXCLUDE a couple of files; this is a problem.  how can I 'walk 
> a directory and look at the next file to be copied and exclude it if 
> necessary'?
>  my source directory will look something like 
> this:'/Backup-HD/DailBckups/DayOfWeek-Evening/'; destination 
> '/FolderToCopyTo/'.  I'm currently ending the source with a wild-card 
> '*' to copy everything.
> 	Any suggestions on how to EXCLUDE certain files that I know the exact 
> names of?

You ought to be looking at rsync and its --exclude flag

This is the script I use to backup my $HOME directory to a SMB mount 
(SERVER)


rsync -avz 							\
	--delete-after 					\
	--exclude "luomat/.Trash" 		\
	--exclude "luomat/Music" 		\
	--exclude "luomat/Library/Mail"	\
	--exclude "luomat/Library/Application Support/Camino/Cache" \
	--exclude "luomat/Library/Application 
Support/Firefox/Profiles/default.qbq/Cache" \
	--exclude "luomat/Library/Preferences/Opera Preferences/Mail/" \
	--exclude "luomat/Library/Application Support/NetNewsWire/Cache" \
	--exclude "luomat/Library/Caches" \
	--exclude "luomat/Temp" \
	/Users/luomat SERVER:backups/luomat/

TjL



More information about the X-Unix mailing list