The following statements create a new directory access server named directoryserver3 that can be used to access up to three
levels of subdirectories, create an external login to the directory access server for the DBA user, and create a proxy table
named diskdir3.

Using the sp_remote_tables system procedure, you can see all the subdirectories located in c:\mydir on the computer running the database server:

CALL sp_remote_tables( 'directoryserver3' );

Using the following SELECT statement, you can view the contents of the file c:\mydir\myfile.txt:

SELECT contents
FROM diskdir3
WHERE file_name = 'myfile.txt';

Alternatively, you can select data from the directories:

-- Get the list of directories in this disk directory tree.
SELECT permissions, file_name, size
FROM diskdir3
WHERE PERMISSIONS LIKE 'd%';
-- Get the list of files.
SELECT permissions, file_name, size
FROM diskdir3
WHERE PERMISSIONS NOT LIKE 'd%';