![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Perl Script Error with find command | MKNENI | Shell Programming and Scripting | 4 | 03-26-2008 09:02 AM |
| find command with exec doesnt work | funtochat2002 | Shell Programming and Scripting | 6 | 07-26-2006 11:29 AM |
| Find command with prune and exec options | Sebarry | UNIX for Dummies Questions & Answers | 2 | 06-19-2006 01:07 AM |
| Find command with prune and exec | Sebarry | UNIX for Advanced & Expert Users | 1 | 06-18-2006 10:43 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
find command exec error
Hi All,
i am writing a shell script in korn shell which deletes all the files in a directory once in every 10DAYS. the directory has different format files. the script has something like this; cd /home/data/pavi echo "Please Enter the Number of Days to search for" read DAYS echo "The entered number of days is $DAYS" DOACTION="rm -rf" find DD.* -maxdepth 1 -mtime +$DAYS -exec $DOACTION {} \; find AA.* -maxdepth 1 -mtime +$DAYS -exec $DOACTION {} \; the script is working fine DD.* extension. But for those files with AA.* extension i am getting the following error message; pav.ksh[33]: find: Argument list too long. there are total 22,309 files with AA.* extension. can anyone please suggest me the best approach here, thanks pavi |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Check the max length of arguments to exec:
Code:
grep 'ARG_MAX' /usr/include/limits.h Code:
find AA.* -maxdepth 1 -mtime +$DAYS | xargs $DOACTION Tayyab Last edited by tayyabq8; 06-12-2006 at 09:43 PM. |
|
#3
|
||||
|
||||
|
Quote:
find . -name "DD.*" -maxdepth 1 -mtime +$DAYS -exec $DOACTION {} \; find . -name "AA.*" -maxdepth 1 -mtime +$DAYS -exec $DOACTION {} \; Quote:
Regards. |
||||
| Google The UNIX and Linux Forums |