![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help on a perl script to edit file | meghana | Shell Programming and Scripting | 9 | 05-14-2008 11:42 AM |
| i want to edit my jsp page using script | nsundaram_cse | Shell Programming and Scripting | 2 | 08-14-2007 04:16 AM |
| How to EDIT file using VI in a script | bobk544 | Shell Programming and Scripting | 2 | 07-25-2007 06:16 AM |
| Can we edit crontab using a shell script | rudrarajumk | Shell Programming and Scripting | 3 | 03-31-2005 06:51 AM |
| Javascript: Edit a script ? | perleo | Shell Programming and Scripting | 1 | 05-23-2003 03:45 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
HP-ux: Script edit
Hallo Friends,
I have written a script which goes through different directories deleting files but I think there is a shorter way I can do this please help. #!/bin/ksh #set -x cd /minotaur/Data/CFD_Input/E_CIF cd 051 for files in 2008* do rm -rf $file done # cd ../052 for files in 2008* do rm -rf $file done # cd ../053 for files in 2008* do rm -rf $file done # cd ../054 for files in 2008* do rm -rf $file done # cd ../055 for files in 2008* do rm -rf $file done # cd ../056 for files in 2008* do rm -rf $file done # cd ../057 for files in 2008* do rm -rf $file done # cd ../058 for files in 2008* do rm -rf $file done # cd ../059 for files in 2008* do rm -rf $file done # cd ../060 for files in 2008* do rm -rf $file #END OF SCRIPT# |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
As your are searching for one single pattern "2008*" it should be easier like this...
as per your case... cd /minotaur/Data/CFD_Input/E_CIF find . -name "2008*" | xargs rm -f that should delete all the files matching the pattern given. -ilan |
|
#3
|
||||
|
||||
|
Hallo Ilan,
I tried the script you wrote for me but It is not deleting some of the files. I checked the permissions on the files and they are rw-rw-rw. Is there another way I can force a deletion? |
|
#4
|
|||
|
|||
|
Quote:
can you post the file name which were not deleted? -ilan |
|||
| Google The UNIX and Linux Forums |