Jump to content
  • Advertisement
Sign in to follow this  
fpsgamer

Help writing a bash script.

This topic is 3937 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have three directories 'sourceA' 'sourceB' and 'destination' Directories 'sourceA' and 'sourceB' contain a large number of files which exist both directories -- meaning the files have the same filenames, but are actually different files. I want to iterate over every file name and execute a command on them of the form: lipo -create sourceA\FILE sourceB\FILE -output destination\FILE Help would be appreciated.

Share this post


Link to post
Share on other sites
Advertisement
If sourceA and sourceB have the exact same files, you can just do this on the command line in the dir that contains sourceA, sourceB, and destination (or make a script out of it):

for f in sourceA/*; do lipo -create sourceA/$f sourceB/$f -output destination/$f; done

If not, you'll have to find the intersection of sourceA and sourceB and iterate over that.

Share this post


Link to post
Share on other sites
outRider: your approach would prepend 'sourceA/' to all file names.

I would suggest something like:
for f in `ls sourceA`
do
if [ -e sourceB/$f ]
then
lipo -create sourceA/$f sourceB/$f -output destination/$f
fi
done

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!