| View previous topic :: View next topic |
| Author |
Message |
Access Voice
Joined: 04 Jun 2006 Posts: 22
|
Posted: Mon Aug 28, 2006 10:10 am Post subject: How many Files in Folder? |
|
|
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...? |
|
| Back to top |
|
 |
krimson Halfop

Joined: 19 Apr 2006 Posts: 86
|
Posted: Mon Aug 28, 2006 10:21 am Post subject: |
|
|
for the first question:
| Code: | set filenum 0
foreach entry [glob -directory /filebase/ *.moep] {
incr filenum
}
return $filenum |
and for the second:
| Code: | foreach entry [glob -directory /filebase/ *.moep] {
file delete $entry
} |
|
|
| Back to top |
|
 |
Access Voice
Joined: 04 Jun 2006 Posts: 22
|
Posted: Mon Aug 28, 2006 11:21 am Post subject: |
|
|
| very nice! thx! |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Mon Aug 28, 2006 1:56 pm Post subject: |
|
|
Why use incr?
| Code: |
proc filecount {file} {
return [llength [glob -nocomplain $file]]
}
|
Could be used with [filecount /home/myuser/*.something] |
|
| Back to top |
|
 |
|