Bill Christens-Barry wrote: > 1. In the local function rootContents above, I find that if I try to > print the value of rootFile$ returned by > > rootFiles$ = FILES$(-x, "",root$, volRefNum%) > > I get gibberish. Why is this? What is actually returned by FILES$() > used in this manner? It looks like FN rootContents is specially designed to print all the contents of an indicated volume or folder. It looks like you must pass to the function a full path name of a directory. The string you pass must begin with the volume's name, and must end with a colon. If you pass a string in a different form, I think FN rootContents won't work right. In general, you can pass either a full or partial path name in the 3rd parameter of FILES$(-x,...), as long as the path name specifies a directory (rather than a file). A full path name always contains at least one colon but never begins with one. A partial (relative) path name either begins with a colon, or contains no colons. If you use a partial path name, the path is considered to be relative to the current default directory. The simplest partial path name is just ":", which indicates, "the current default directory." Examples: FILES$(-n, , ":", v%) returns an item in the current default directory; FILES$(-n, , "myDisk:", v%) returns an item at the root level of the volume called "myDisk" (note the colon); FILES$(-n, , "xyz", v%) looks for a folder called "xyz" within the current default directory, and returns an item that's in "xyz" (note no colon); FILES$(-x,,path$,vRefNum%) returns the name of a file or folder which is located in the directory specified by path$. If the returned name ends with a colon, it's a folder; otherwise it's a file. If "x" is greater than the number of files & folders within the specified directory, then FILES$ returns an empty string. FILES$ only returns the names of items within the _first level_ of the indicated directory--not within any deeper directories. > > 2. How can I pass the filenames that are simply printed in > rootContents to the local fn filterAFile in the first program? I'm > unsure about how the volRefNum% and folderVolRefNum% commands work > and so I don't know how to pass the file location information to the > filtering routine. > FILES$(-x, , path$, vRefNum%) returns a true volume reference number (_not_ a working directory reference number, strangely enough) corresponding to the volume which contains the returned item. This number is _not_ suitable for passing to the OPEN statement, unless the file you want to open happens to be in the volume's root directory. Your best bet may be to try to build a full path name ending with the file's name, and passing that to OPEN (when you pass a full path name to OPEN, the vRefNum% parameter is ignored). - Rick