Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need remove a specific files from file system

Status
Not open for further replies.

netmen

IS-IT--Management
Dec 18, 2000
2
MX




Hello,

I need remove many files that are stored in directories which the same name, but in diferent places, for example,
/usr/tom/temp/file1, file2
/usr/peter/temp/fil1, fil2
/usr/john/temp/temp1, temp2




how can i use the awk for do it

 
Using awk isn't really necessary to solve your problem. Here's a cheesy script to do what you want:

#!/bin/sh

DIRNAME=/temp
BASE=/usr

for DIR in `find $BASE -type d -name $DIRNAME`
do
rm -f $DIR/*
done

Maybe someone can come up with something more elegant.

HTH,


Russ
bobbitts@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top