[X-Unix] Copying to multiple directories

Harvey Riekoff parktrack at mac.com
Thu Mar 11 04:38:31 PST 2004


Upon further investigation, if I have three users named bob, carol and  
alice, and use the command "cp fileA /Users/*/Library", fileA is copied  
into carols Library folder but not to anyone elses.

Also when I run the command "$ ls -d /Users/*/Library | xargs -I % echo  
cp fileA %"  I get the following message "su: $: Command not found"

In OS 9 is a utility written by an Australian guy (Stewart Macdonald  
???) that I used to use, that would copy a single file to a location in  
every users directory. I am assuming that there must be an "easy?" way  
to accomplish this same task in OS X.

Thanks to everyone for their continued help with this.


On Mar 11, 2004, at 2:08 AM, Kuestner, Bjoern wrote:

> Uh, ah, I don't exactly understand how Brian's solution works (it is a
> solution, Brian, right?), and I hesitate to run any command that I  
> don't
> understand "just to find out". (c:
>
> (It's this "echo" that confuses me ... I would have expected something  
> like
> "exec" or ` `? And then there are no ' ' or " " afterwards for what is
> handed to "echo"?)
>
> But Harvey, the problem with your command is that you command expands  
> to:
>
> cp -r fileA /Users/john/Library /Users/mary/Library /Users/liz/Library
>
> cp accepts the last parameter alone as the target!
>
> Another note: For just one file you don't need "-r".
>
> But since you do have "-r", I would have expected this to copy file A,
> john's Library and mary's Library all to liz' Library. Can anybody  
> explain
> why (according to Harvey) that isn't happening?
>
> Also, Harvey, be aware that with using cp you're losing all  
> information in
> the resource fork. Bad for OS 9 apps, images with previews and other  
> things.
>
> Alternatives are the commands CpMac and ditto:
> http://www.westwind.com/reference/OS-X/commandline/files-folders.html
>
> Bjorn
>
>
> --------------------
>
>
> ----------------------------------------------------------------------- 
> ---------
> The information contained herein is confidential and is intended  
> solely for the
> addressee. Access by any other party is unauthorised without the  
> express
> written permission of the sender. If you are not the intended  
> recipient, please
> contact the sender either via the company switchboard on +44 (0)20  
> 7623 8000, or
> via e-mail return. If you have received this e-mail in error or wish  
> to read our
> e-mail disclaimer statement and monitoring policy, please refer to
> http://www.drkw.com/disc/email/ or contact the sender.
> ----------------------------------------------------------------------- 
> ---------
>
>
> ----------
> Check out the Mac OS X email list FAQ
> http://www.themacintoshguy.com/lists/X.html
>
> To unsubscribe, E-mail to: <X-Unix-off at lists.themacintoshguy.com>
> To switch to the DIGEST mode, E-mail to  
> <X-Unix-digest at lists.themacintoshguy.com>
> Need help from a real person? Try.   
> <X-Unix-request at lists.themacintoshguy.com>
>
> ----------
> $14.99 Unlimited Nationwide Mac Dialup and Mac Web Hosting from your  
> Mac ISP
> Serious Mac Internet Solutions From NineWire!    
> http://macinternetaccess.com
>
> DVIator   | Run Dual ADC displays on your G4 or just one on an older  
> Mac!
> Dr. Bott  | <http://www.drbott.com/prod/DVIator.html>
>
>    Support   | Support this list by clicking here before you buy!
>   this List  |  http://www.themacintoshguy.com/support.html
>
> OS X News, Dr.Mac, Forums, Tutorials, Tips, Hints, FAQ?s -  
> http://www.osxfaq.com
>
>
Harvey Riekoff
Technology Trainer ( and quasi systems analyst)
Racine Unified School District
Racine, WI 53402
tjbanjo at wi.net
hriekoff at racine.k12.wi.us



More information about the X-Unix mailing list