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!

Deleting files previously selected with awk 1

Status
Not open for further replies.

blodwyn

IS-IT--Management
Mar 23, 2001
24
I need to write a script that will automatically delete files in a set directory (dir1) on our ftp server if the files have ben downloaded.
Once downloaded, details of the files are contained in the ftp log file and I have extracted their names using awk, into a file (file1)
I can then do:-
# for x in `ls dir1`
> do
> grep $x file1
> done
which will give me the required file names (ie those appearing in both)
How can I add a command that will carry on and delete these files?
 
Hi blodwyn-

Try this:

for x in `cat file1`
do
rm -f $x
done

HTH


flogrr
flogr@yahoo.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top