• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: shell script to selectively copy files?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.



References: 
 >shell script to selectively copy files? (From: Chuck Soper <email@hidden>)
 >Re: shell script to selectively copy files? (From: Chuck Soper <email@hidden>)
 >Re: shell script to selectively copy files? (From: Paul Russell <email@hidden>)

  • Prev by Date: Re: Shark can't find source code
  • Next by Date: Re: One Target, separate apps
  • Previous by thread: Re: shell script to selectively copy files?
  • Next by thread: Disabling a Processor
  • Index(es):
    • Date
    • Thread