[X-Unix] Script - works, but not where I need it to

Philip Ershler ershler at cvrti.utah.edu
Wed Jun 30 22:24:02 PDT 2004


Believe it or not when Unix goes to copy a bunch of files, it strings 
them all together into one command. For example, say you have 15 files 
in a directory named file.1, file.2, file.3 etc. If you say

cp file.* /some/directory/

the shell expands that to

cp file.1 file.2 file.3 file.4 ... file.15 /some/directory/

so if you have a large number of files to perform some operation on, 
the actual command line can become enormous. You've got to find some 
way of looping the operation or some other method that won't make the 
actual command line too long.

HTH,

Phil

On Jun 30, 2004, at 7:08 PM, Bert Knabe wrote:

> I have a shell script to copy all files added to a folder in the last 
> 24 hours to another folder. It works, but only when invoked from my 
> computer. When invoked on our Xserve, it gets the following error:
>
> [computer:/Users/Shared] admin% sh filecopy22.txt
> filecopy22.txt: /usr/bin/find: Argument list too long
>
> The script is just a line or two:
>
> find /Volumes/composing/\ \ \ Running\ Ads/* -mtime 1 -exec cp -p {} 
> /Volumes/Online/\PDF\'S/In/ \;
>
> The computers are:  iMac 400 DV 512 meg RAM OS X 10.3.4
> 			Xserve w/RAID 2gig RAM OS X 10.2.8
>
> Bert Knabe
> Computer Technician
> Lubbock Avalanche Journal
> (806) 766-2158
>
>
> ----------
> 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



More information about the X-Unix mailing list