Page 1 of 1

deleting files with the sam extension

Posted: Mon Feb 07, 2011 9:44 am
by bestefan
hi,

:foreach i in=[/file find] do={:if ([:typeof [:find [/file get $i name] ".rsc"]]!="nil") do={/file remove $i}}
:foreach i in=[/file find] do={:if ([:typeof [:find [/file get $i name] ".backup"]]!="nil") do={/file remove $i}}

this script remove all rsc and backup files in Mt 3.x. Working nice.
But, in 4.x remove only .rsc, and the .backups are left over.
Any idea, how can i fix it?

Thanks, bestefan

Re: deleting files with the sam extension

Posted: Mon Feb 07, 2011 12:42 pm
by janisk
on 5.0rc8:
/file remove [find type="backup"]
/file remove [find type=".rif file"]
have to check what type you want to find before.

this can be done this way as /file remove command supports multiple arguments.

Re: deleting files with the sam extension

Posted: Thu Sep 27, 2018 6:03 pm
by ik3umt
janisk :

/file remove [find type=".rif file"] is OK

But what if I have to delete all .rif files that are into a directory ? Which syntax ?

P:S: I mean ONLY the .rif files that are inside a particular directory, not other .rif files