Computing.Net > Forums > OpenVMS > scipt: OPENVMS

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

scipt: OPENVMS

Reply to Message Icon

Name: hitesh.t
Date: August 27, 2009 at 09:56:41 Pacific
OS: OpenVMS
Subcategory: General
Tags: script
Comment:

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.



Sponsored Link
Ads by Google

Response Number 1
Name: Joseph.Huber
Date: August 27, 2009 at 10:21:18 Pacific
Reply:

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 nf

Joseph Huber, http://www.huber-joseph.de
ITRC


0
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: scipt: OPENVMS

openvms to linux/windows NT migration www.computing.net/answers/openvms/openvms-to-linuxwindows-nt-migration/18.html

C Shell Interpreter for OpenVMS? www.computing.net/answers/openvms/c-shell-interpreter-for-openvms/21.html

VTfm - OpenVMS file manager www.computing.net/answers/openvms/vtfm-openvms-file-manager/326.html