Votes

Add UTL_FILE program to return files in a directory. (details)
 
Dear Bryn,

I love PL/SQL and was especially pleased to see UTL_FILE upgraded in Oracle9i to delete, copy and move files. And support for database directories: fantastic!

But I still often need to get the list of files within a directory and would love it if Oracle could add this capability directly to UTL_FILE.

Thanks so much!

UTL_FILE, Oracle PL/SQL's supplied package for reading and writing operating system files, got a nice upgrade in Oracle9i, but it still is lacking badly in one area: there is no way to ask for the list of files in a directory. Lots of people want to do this.


Ideally, this program would accept the directory as a literal or the name of a database directory object, and a filter - and then return the list of files that match the filter in that directory.

Something like this:

PACKAGE UTL_FILE
AS
TYPE file_names_t IS TABLE OF VARCHAR2(32767)
INDEX BY PLS_INTEGER;

FUNCTION files_in_directory (
directory_in IN VARCHAR2
, delimiter_in IN VARCHAR2
)
RETURN file_names_t;


PACKAGE UTL_FILE
AS
   TYPE file_names_t IS TABLE OF VARCHAR2(32767)
      INDEX BY PLS_INTEGER;

   FUNCTION files_in_directory (
      directory_in IN VARCHAR2
    , delimiter_in IN VARCHAR2
   )
   RETURN file_names_t;


Steven Feuerstein, PL/SQL Evangelist, Quest Software: "Help me help Oracle improve the PL/SQL language!"


Bryn Llewellyn: "We love to hear from PL/SQL developers. Let us know what is important to you!"

PL/SQL Obsession
Apex Evangelists
O'Reilly Books on Oracle
OTN PL/SQL Best Practices
OTN PL/SQL Page
Steven Feuerstein's Blog