Re: shell script to selectively copy files?
Re: shell script to selectively copy files?
- Subject: Re: shell script to selectively copy files?
- From: Chuck Soper <email@hidden>
- Date: Mon, 12 Jul 2004 16:12:22 -0700
At 10:13 PM -0700 7/8/04, Paul Russell wrote:
On Jul 8, 2004, at 4:47 PM, Chuck Soper wrote:
I just glanced at the man page for rsync. It looks very useful for
my situation. I'll keep it in mind for when I try to write a
smarter shell script. It'd be nice to see an example of rsync in an
Xcode shell script target or build phase (if anyone has one).
Just change ditto to rsync -a and put trailing slashes on your paths, i.e.
% ditto "$SRCROOT/subDir/fileName"
"$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/subDir/fileName"
becomes
% rsync -a "$SRCROOT/subDir/fileName/"
"$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/subDir/fileName/"
Paul
Thanks. That works absolutely great. It's just what I needed. I use
'rsync -av' (verbose output) so I can look in the build output and
determine what files, if any, were copied. Here's what my script
looks like:
echo "rsync verbose output:"
mySrcPath="$SRCROOT/data"
myDestPath="$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/data"
#files:
rsync -av "$mySrcPath/myFile1" "$myDestPath/myFile1"
rsync -av "$mySrcPath/myFile2" "$myDestPath/myFile2"
#directories:
rsync -av "$mySrcPath/subDir1/" "$myDestPath/subDir1/"
rsync -av "$mySrcPath/subDir2/" "$myDestPath/subDir2/"
The script variables make it more readable and less error prone.
I use this Xcode shell script build phase in multiple targets. I have
a separate exact copies of the script in each target. I'd like to
maintain one script file for multiple targets. Does anyone know how
to do that? I don't think I can call a separate script file because
of scoping issues (i.e. that script wouldn't see $SRCROOT etc., I
think).
Chuck
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.