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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting files??,

Status
Not open for further replies.

sergelaurent

Technical User
May 30, 2005
52
0
0
FR
I have a folder container several files, let say:
toto.txt
titi.fxd
fim.txt
yot.fxd
and fifi.log

I want to do delete all files with the .txt and .fxd extension!!!

how can i do this automatically?
 
perhaps something like:
Code:
foreach fnam [glob *.txt *.fxd] {file delete -force $fnam}

_________________
Bob Rashkin
 
Thanks for the tips bong!!

However, I am getting a problem when ther is no *.txt files in the folder!!!

The problem is that I have to do this in several folders and sometimes there are *.fxd files only and sometimes both!!!

So, I need something which works in all cases!!!

Can you help me to solve this?
 
Code:
foreach fnam [glob [b]-nocomplain[/b] *.txt *.fxd] {file delete -force $fnam}

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top