[COLUG] gawk question

Nathan Overley noverley at sm.k12.oh.us
Sat Aug 19 11:21:51 EDT 2006


Thanks for the suggestions. Is there a way to dynamically assign the STUDENT 
variable with the names of the users directories?

Thanks,
Nathan

>===== Original Message From jmglov at wmalumni.com, Central OH Linux User Group 
<colug432 at colug.net> =====
>On 19/08/06, Steven Huwig <shuwig at columbus.rr.com> wrote:
>
>>    $ find -d . -mindepth 2 \! -name career -exec rm -d -i {} \;
>>
>> The -i flag at the end will prompt you for every file deletion, since
>> I didn't test that command line thoroughly.
>
>Good suggestion. With dangerous commands, I usually do this first:
>
>STUDENTS="User1 User2 ... UserN"
>cd /home
>for i in ${STUDENTS}; do
> find $i/ -maxdepth 1 -type -d \! -name career | xargs echo rm -rf
>done
>
>(Thanks for the "\! -name foo" trick--I did not know that bit of find
>syntax). Then, I inspect the output, and if satisfied, remove the
>"echo" (or, in most cases, replace it with "sudo"), as such:
>
>STUDENTS="User1 User2 ... UserN"
>cd /home
>for i in ${STUDENTS}; do
> find $i/ -maxdepth 1 -type -d \! -name career | xargs sudo rm -rf
>done
>
>The key point to take away is to be *very* careful with destructive
>commands, especially when executing them as root!
>
>-Josh
>_______________________________________________
>colug432 mailing list colug432 at colug.net
>http://www.colug.net/mailman/listinfo/colug432





More information about the colug432 mailing list