[COLUG] gawk question

Steven Huwig shuwig at columbus.rr.com
Sat Aug 19 12:08:47 EDT 2006


On Aug 19, 2006, at 11:21 AM, Nathan Overley wrote:

> Thanks for the suggestions. Is there a way to dynamically assign  
> the STUDENT
> variable with the names of the users directories?
>
>> for i in ${STUDENTS}; do
>> find $i/ -maxdepth 1 -type -d \! -name career | xargs echo rm -rf
>> done

Sure,

ls | while read i
do
...
done

But I am pretty sure it is overkill as the find command I sent

     find -d . -mindepth 2 \! -name career -exec rm -d -i {} \;

should do it all for you when run in the parent of the UserN  
directories.
If you don't trust it you can change it to

     find -d . -mindepth 2 \! -name career -print

to see which files are being found.


-- Steve Huwig





More information about the colug432 mailing list