Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Can any1 help me :
if i want to know the no. of file in a paricular directory, how to find it.
I want to use that o/p in loop,
so o/p should be in digits.
Eg. 81
so that this 81 i can use in loop.
if i use
$ dir/total .
i am getting o/p as: Total of 81 files.
but i need only 81 so that loop can run 81 times.

The command
$ pipe directory/total | -
(read sys$pipe line ; read sys$pipe line ; -
read sys$pipe line ; read sys$pipe line ; -
n=f$element(2," ",line) ; define/job NF &n)puts the number into the job logical nf.
Then
nf=f$trnlnm("NF")
puts the number into the symbol NF.This procedure depends on the output format of the directory command.
Depending on the purpose of Your question, a more secure would be a loop like this nf.com:
$ if p1.eqs."" then p1="*.*;*"
$ n=0
$ stream=0
$ loop:
$ f=f$search(p1,stream)
$ if f.eqs."" then goto end
$ n = n + 1
$ goto loop
$ end:
$ write sys$output "Number of files: ",n
$ nf == n !return number in global symbol nfJoseph Huber, http://www.huber-joseph.de
ITRC

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |