Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Subject: Search recursively

Original Message
Name: Stephen McBride
Date: January 7, 2005 at 20:44:00 Pacific
Subject: Search recursively
OS: OpenVMS
CPU/Ram: Not sure
Comment:
Hi there. I'm having a small problem with trying to write a script that will perform the following 3 items..

1) Search recursively from [000000] directory and all subfolders for all ".EXE" files..

2) As it finds each ".EXE" file place the full filename syntax of the executeable into a "text" file called "report.dat" (Eg; if it found "dummyfile.exe" then write to the text file: GXPROSYS:[RUNDIR]DUMMYFILE.EXE)

3) Not sure if an "end of file" marker is required at the end of the "text" file as I have another script that will then read in this "text" file..

Below is what I've come up with...

SET DEF [000000]
DIR [...]*.COM /COLUMNS=1 /OUTPUT=REPORT.DAT

This finds all the ".EXE" files and places the output into "REPORT.DAT" except it looks like this (below)


Directory GXPROSYS:[000000.MRPT.PRIVATE]

PROGRAM1.EXE
PROGRAM2.EXE
PROGRAM3.EXE

Total of 3 files.


I would really like it to look like this...

GXPROSYS:[000000.MRPT.PRIVATE]PROGRAM1.EXE
GXPROSYS:[000000.MRPT.PRIVATE]PROGRAM2.EXE
GXPROSYS:[000000.MRPT.PRIVATE]PROGRAM3.EXE

Has anyone got any ideas ?? Not sure if I should be using F$SEARCH or doing some sort of LOOP.. Ie; as it finds the ".EXE" append to the end of the ".DAT" file.. All comments appreciated..

Thankyou in advance :)
Stephen McBride



Report Offensive Message For Removal

Response Number 1
Name: Bob Gezelter
Date: January 8, 2005 at 04:17:44 Pacific
Subject: Search recursively
Reply: (edit)
Stephen,

Actually, what you are looking for is fairly simple.

If I understand you correctly, you are seeking the same basic functionality that is used to list files by the DIRECTORY command. For example, the DIRECTORY command to list all executable binary files on a disk would be DIRECTORY devicename:[000000...]*.EXE. The "000000" is a reference to the MFD (Master File Directory) which is the root of the directory structure on a file-structured volume.

The iterative search functionality is actually a part of RMS, the Record Management System. From DCL, it can be accessed using the F$SEARCH lexical function, as illustrated by the following small code segment that iteratively scans for all executable files on volume DKA200:

$ TOP: FILENAME = F$SEARCH("DKA200:[000000...]*.EXE")
$ IF F$LENGTH(FILENAME) .EQ. 0 THEN EXIT
$ WRITE SYS$OUTPUT FILENAME
$ GOTO TOP

While it is guaranteed that every executable file will show up at least once, it is also possible to see files more than once, because of the possibility of alias entries for directories.

When the search is complete, the result of FF$SEARCH will be an empty string.

Since you get the filenames back one filename at a time, there is a good chance that you will not need an intermediate file.

You may also find my presentation on DCL lexical functions from the 1995 San Francisco DECUS User's symposium, "DCL Lexicals: OpenVMS Jujitsu", useful. The slides from that session can be found at:

http://www.rlgsc.com/decus/usf95/index.html

- Bob Gezelter, http://www.rlgsc.com


Report Offensive Follow Up For Removal

Response Number 2
Name: erensm
Date: January 8, 2005 at 13:51:57 Pacific
Subject: Search recursively
Reply: (edit)
use :
$ dir /noheader /notrailer

Report Offensive Follow Up For Removal

Response Number 3
Name: Stephen McBride
Date: January 8, 2005 at 23:03:07 Pacific
Subject: Search recursively
Reply: (edit)
Bob,

Thankyou for your timely response. Your example code nailed my problem right on the head (required some slight ammendments but otherwise perfect for the problem at hand)

Kinds regards
Stephen McBride


Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Search recursively

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software



Version Tracker Pro
Keep your software current and secure, effortlessly

Click Here for a Free Scan

Driver Agent
Automatically find the latest drivers for your computer.
Click Here for a Free Scan



The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC