Anything that counts files will have to do so the same way: checking directory entries. So there's no special "faster ls". (If there was, why wouldn't we use it for everything?)
If you can compile on this machine, this program can provide a running total, updated once a second:
It only reads from stdin.
---------- Post updated at 10:30 AM ---------- Previous update was at 10:26 AM ----------
Quote:
Originally Posted by verdepollo
I'm still trying to figure out how to count those files. It would be enough for me if I could find out an approximate value, and not the exact number.
Very approximate since it includes directory entries as well, but since counting 4 million files is going to be hard, it might have to do.
I am trying to write a script that will look for a file in a directory, then remove it. I need it to loop until it has removed a certain number of files. Is it better to do a repeat or to list each file in a pattern? Files will be numbered like RAF.01.*, RAF.02.*, etc. Thanks, James (6 Replies)
Some simple questions from a simple man.
If i wanted to count the number of files contained within a directory, say /tmp would ls -l /tmp ¦ wc -l suffice and will it be accurate?
second one: How would i check the number of files with a certain string in the filename, in the same directory.
... (2 Replies)
I want to count the no of lines for files (.c and .h) present in a directory structure.
My code is:
#!/bin/bash
# Usage: linecount.sh directory_name
for file in $(find $1 -name ); do
wc -l "$file" >> filecount.txt
done
Problem is that the directory structure is really big... (3 Replies)
I have 20 files in a direcotry like BARE01_DLY_MKT_YYYYMMDD. The MKT differes for all these files but the remaining syntax remains the same for a particular day. If I am checking for today I need to make sure that there are 20 files that start with BARE01_DLY_MKT_20060720. How can I write a... (31 Replies)
I've never toyed with awk, but it seems every time I present an elegant 2- to 8-line script, someone comes back with an awk 1-liner.
I just came up with this to count all the lines of source code in a directory. How would I do it in awk?
LINES=0
for n in $(wc -l *.cpp *.h | cut -b-7); do
... (2 Replies)
Hello, I'm writing a script in sh in which the first command line argument is a directory. from that, i'm suppose to count the number of readable, writable, and executable items in the directory. I know using $1 represents the directory, and ls would display all the items in the directory, and that... (4 Replies)
Help Needed !
Can we count number of folders of specific date in a directory, even if directory has folders of different dates.
Please reply as soon as possible. (1 Reply)
I am trying to display the output of ls and also print the number of characters in EVERY file name. This is what I have so far:
#!/bin/sh
for x in `ls`; do
echo The number of characters in x | wc -m
done
Any help appreciated (1 Reply)
So I have a loop that stated if a directory exists or not. If it does it prints the number of files within that directory. I use this code...
result=`(ls -l . | egrep -c '^-')`
However, no matter which directory I input, it outputs the number "2"
What is wrong here? (4 Replies)
Discussion started by: itech4814
4 Replies
LEARN ABOUT DEBIAN
tau_profile_timer_dynamic
TAU_PROFILE_TIMER_DY(3) TAU Instrumentation API TAU_PROFILE_TIMER_DY(3)NAME
TAU_PROFILE_TIMER_DYNAMIC - Defines a dynamic timer.
SYNOPSIS
C/C++:
TAU_PROFILE_TIMER_DYNAMIC(Profiler timer, char* or string& function_name, char* or string& type, TauGroup_t group);
Fortran:
TAU_PROFILE_TIMER_DYNAMIC(integer profiler(2), character name(size));
DESCRIPTION
TAU_PROFILE_TIMER_DYNAMIC operates similar to TAU_PROFILE_TIMER except that the timer is created each time the statement is invoked. This
way, the name of the timer can be different for each execution.
EXAMPLE
C/C++ :
int main(int argc, char **argv) {
int i;
TAU_PROFILE_TIMER(t,"main()", "", TAU_DEFAULT);
TAU_PROFILE_SET_NODE(0);
TAU_PROFILE_START(t);
for (i=0; i&5; i++) {
char buf[32];
sprintf(buf, "Iteration %d", i);
TAU_PROFILE_TIMER_DYNAMIC(timer, buf, "", TAU_USER);
TAU_PROFILE_START(timer);
printf("Iteration %d
", i);
f1();
TAU_PROFILE_STOP(timer);
}
return 0;
}
Fortran :
subroutine ITERATION(val)
integer val
character(13) cvar
integer profiler(2) / 0, 0 /
save profiler
print *, "Iteration ", val
write (cvar,'(a9,i2)') 'Iteration', val
call TAU_PROFILE_TIMER_DYNAMIC(profiler, cvar)
call TAU_PROFILE_START(profiler)
call F1()
call TAU_PROFILE_STOP(profiler)
return
end
SEE ALSO TAU_PROFILE_TIMER(3), TAU_PROFILE_START(3), TAU_PROFILE_STOP(3)
08/31/2005 TAU_PROFILE_TIMER_DY(3)