This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.
Help for those learning Tcl or writing their own scripts.
-
Access
- Voice
- Posts: 22
- Joined: Sun Jun 04, 2006 6:31 am
Post
by Access »
I want to know how many files with ending *.moep are in /filebase/ folder...
How? ^^ (Too short? dont know how to explain...)
2nd question - no extra thread:
how to delete all files with ending *.moep in /filebase/ folder...?
-
krimson
- Halfop
- Posts: 86
- Joined: Wed Apr 19, 2006 8:12 am
Post
by krimson »
for the first question:
Code: Select all
set filenum 0
foreach entry [glob -directory /filebase/ *.moep] {
incr filenum
}
return $filenum
and for the second:
Code: Select all
foreach entry [glob -directory /filebase/ *.moep] {
file delete $entry
}
-
Access
- Voice
- Posts: 22
- Joined: Sun Jun 04, 2006 6:31 am
Post
by Access »
very nice! thx!
-
metroid
- Owner
- Posts: 771
- Joined: Wed Jun 16, 2004 2:46 am
Post
by metroid »
Why use incr?
Code: Select all
proc filecount {file} {
return [llength [glob -nocomplain $file]]
}
Could be used with [filecount /home/myuser/*.something]