PLSQL to Read File Names from a Directory

Interested in a sample of PLSQL code that reads from a UNIX directory the list of files in the directory for further processing in the program.
Thank you.
Mona

this should do the trick
http://asktom.oracle.com/pls/ask/f?p=4950:8:804140
greetings
Freek D'Hooge
Interested in a sample of PLSQL code that reads from a UNIX directory the list of files in the directory for further processing in the program.
Thank you.
Mona

Similar Messages

  • Can we possible to retrive the file name from the directory...?

    Can we possible to retrive the list of files or file names from the directory...?
    The directory called create or replace directory [directory_name] as ....

    Yeah, yeah its very good example for this scenario.
    I agree. But, I want to learn about Java based PL/SQL code development for that just I am asking any link for this kind of material.....:-)

  • How to get list of file names from a directory?

    How to get list of file names from a directory?
    Please help

    In addition, this:
    String filename = files;Should be this:
    String filename = files;
    That's just because he didn't use the "code" tags, so [ i ] made everything following it become italicized.                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Error while reading file name in a directory

    Hi,
    I am trying to read all the file names within a directory, however  I get the below error while running the code.
    Run-time error '5':
    Invalid procedure call or argument
    The actual path is "Q:\Budget\Historical Budgets\FY15\*.xls*"
    and ThisWorkbook.Sheets(1).Range("A1").Value = FY15 in my excel sheet.
    "Below is the code I am using"
    Dim file As Variant
    file = Dir("Q:\Budget\Historical Budgets\" & ThisWorkbook.Sheets(1).Range("A1").Value & "\*.xls*")
    If file = "" Then
            MsgBox "no files"
            Exit Sub
          Else
            ' ... else, count the files
            x = 0
            Do While file <> ""
                x = x + 1
                file = Dir         
    <----  I get the error at this line.
            Loop
    End If
    Could you please help me to solve this problem
    Regards, Hitesh

    Do you want to generate a list of all files in a folder, in your spreadsheet?  If so, please try this sample code?
    Option Explicit
    Private cnt As Long
    Private arfiles
    Private level As Long
    Sub Folders()
    Dim i As Long
    Dim sFolder As String
    Dim iStart As Long
    Dim iEnd As Long
    Dim fOutline As Boolean
    arfiles = Array()
    cnt = -1
    level = 1
    sFolder = "C:\Users\Excel\Desktop\Coding\Microsoft Excel\Work Samples\"
    ReDim arfiles(2, 0)
    If sFolder <> "" Then
    SelectFiles sFolder
    Application.DisplayAlerts = False
    On Error Resume Next
    Worksheets("Files").Delete
    On Error GoTo 0
    Application.DisplayAlerts = True
    Worksheets.Add.Name = "Files"
    With ActiveSheet
    For i = LBound(arfiles, 2) To UBound(arfiles, 2)
    If arfiles(0, i) = "" Then
    If fOutline Then
    Rows(iStart + 1 & ":" & iEnd).Rows.Group
    End If
    With .Cells(i + 1, arfiles(2, i))
    .Value = arfiles(1, i)
    .Font.Bold = True
    End With
    iStart = i + 1
    iEnd = iStart
    fOutline = False
    Else
    .Hyperlinks.Add Anchor:=.Cells(i + 1, arfiles(2, i)), _
    Address:=arfiles(0, i), _
    TextToDisplay:=arfiles(1, i)
    iEnd = iEnd + 1
    fOutline = True
    End If
    Next
    .Columns("A:Z").ColumnWidth = 5
    End With
    End If
    'just in case there is another set to group
    If fOutline Then
    Rows(iStart + 1 & ":" & iEnd).Rows.Group
    End If
    Columns("A:Z").ColumnWidth = 5
    ActiveSheet.Outline.ShowLevels RowLevels:=1
    ActiveWindow.DisplayGridlines = False
    End Sub
    Sub SelectFiles(Optional sPath As String)
    Static FSO As Object
    Dim oSubFolder As Object
    Dim oFolder As Object
    Dim oFile As Object
    Dim oFiles As Object
    Dim arPath
    If FSO Is Nothing Then
    Set FSO = CreateObject("Scripting.FileSystemObject")
    End If
    If sPath = "" Then
    sPath = CurDir
    End If
    arPath = Split(sPath, "\")
    cnt = cnt + 1
    ReDim Preserve arfiles(2, cnt)
    arfiles(0, cnt) = ""
    arfiles(1, cnt) = arPath(level - 1)
    arfiles(2, cnt) = level
    Set oFolder = FSO.GetFolder(sPath)
    Set oFiles = oFolder.Files
    For Each oFile In oFiles
    cnt = cnt + 1
    ReDim Preserve arfiles(2, cnt)
    arfiles(0, cnt) = oFolder.Path & "\" & oFile.Name
    arfiles(1, cnt) = oFile.Name
    arfiles(2, cnt) = level + 1
    Next oFile
    level = level + 1
    For Each oSubFolder In oFolder.Subfolders
    SelectFiles oSubFolder.Path
    Next
    level = level - 1
    End Sub
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • Read file name from Payload (File Adapter)

    Hello experts,
    with Receiver-File Adapter I want to save a specific file. Name is given in the xml payload. I use Variable Substitution.
    My structure is like this:
    <root>
        <elements>
            <name>name1</name>
        </elements>
        <elements>
            <name>name2></name>
        </elements>
    </root>
    File name schema: %file%
    Variable Substitution:
        File Name: file
        Reference: payload:root,1,elements,1,name,1
    With this expression my file adapter creates two files (as recommended), but they have both the name "name1". I want to create n files with n different names, given by one xml structure. How can this task be done? Setting the occurency from "1" to "n" or "*" does not work.
    Thank you very much!
    Ilona Seifert

    Hi,
    Like pointed by you , your source strucutre,
    <root>
        <elements>
            <name>name1</name>
        </elements>
        <elements>
            <name>name2></name>
        </elements>
    </root>
    The target strucuture after mutlimapping will be like,
    My structure is like this:
    <root>
        <elements>
            <name>nameX</name>
        </elements>
       </root>
    Now, using Variable Name substitution, you will have the "name " element at a fixed level  always , <b> payload:root,1,elements,1,name,1</b> and so you Variable Name subsitution will also work fine.
    Hope it clears,
    Regards
    Bhavesh

  • Retreiving the file names from directory inside another directory from application server

    Hi,
    I had a problem in retreiving the file names from a directory inside another directory.
    I tried using the FM's  SUBST_GET_FILE_LIST, RZL_READ_DIR_LOCAL and EPS_GET_DIRECTORY_LISTING
    But here I am getting only one directory details.
    Actually my file is located a directory inside one more directory and one more directory and inside the files are located.
    i.e total 3 directories inside the 3rd one my files are there.
    I need to read the latest file name in the directory.
    So that i can do some manipulation after getting the file name.
    Is there option like OPEN DATASET , READ DATASET and CLOSE DATASET?
    Can anyone please let me know How can i acheive this one.
    Regards
    Ram

    Hi Ram,
        Following thread can be helpful for you, were it shows in the tables structure rsfillst a field RSFILLST-TYPE whether its a directory or file..........
    http://scn.sap.com/thread/865272
    thanks and regards,
    narayan

  • How to delete file names from Adobe Reader list

    How can I delete file names from the Adobe Reader list?  I have deleted the file & it's empty, but deleted file names remain in my list & it's very annoying.  I can't seem to find an option anywhere to delete the file names.

    Thanks for the answer, I will try this & post my results with this method.  I have set the amount to zero, & it seems if I want to put back valid files into my list I first need to find them in another file in my pc, such as documents, open them in Adobe Reader, & then then they will reappear in the Adobe Reader list.  Is this correct?  Thank you!
    This seems to be the case, you need to restore each file you want in your list one by one by accessing them elsewhere on your pc, & then you must open them with Adobe Reader to have files reappear in your Adobe Reader list.  However, this seems to be a tedious process if you only want to delete one obsolete file from your list by first emptying the list & rebuilding it file by file.  It works, but I'm wondering if there is a more sensible & efficient way to do this?

  • Extracting file name from directory folder (~cont)

    what if I want to retrieve indiviual files of a certain file type...e.g. *.jsp file type, from a directory folder??

    You can implement a FileFilter, then use the listFiles method of the File class to return the related files:
    import java.io*;
    public class JspFileFilter implements FileFilter {
         public boolean accept(File pathname) {
              return (pathname.getName().endsWith(".jsp"));
         public static void main(String[] args) {
              File directory = new File("c:/web");
              File[] jspFiles = directory.listFiles(new JspFileFilter());
              for (int i=0;i<jspFiles.length;i++) {
                   System.out.println(jspFiles[ i ].getName());
    }

  • Need help getting files names from directory

    I have never done anything in php before and I'm struggling.
    In an attempt to search through potential document names in a directory, I've added the following code to a new php document:
    <?php
    if ($handle = opendir('.')) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != "..") {
                echo "$file\n";
        closedir($handle);
    ?>
    with no luck. When executed all I get is a blank screen. Any ideas why?
    End goal is to list the file names in the directory so that the user can choose to open desired document. Thanks!

    Click here and pick the option which best fits your situation.
    (93771)

  • File path from specific directory

    hi all ,
    How to get full file path from specific directory having many folder inside that directory.
    I have file name and main directory name,please help me if you know about it

    I recognize that this post is half a year old at this writing, and the OP has probably long since either solved or abandoned the problem in question. That being stipulated: if I understand the question properly, the OP is stating that there is a directory named A, and contained somewhere within that directory or one (or more) of its subdirectories is one (or more) file(s) named abc.txt, and OP would like to be able to locate and obtain the canonical path to said file(s). While I am in no way a java maven, I've written a brief program which appears to do exactly that:
    import java.io.*;
    public class Main {
        public Main() {
            String whatImLookingFor = "abc.txt";
            String startingDirectory = "A";
            File path = new File("A");
            recursivelySearch(path, whatImLookingFor);
        private void recursivelySearch(File path, String whatImLookingFor) {
            try {
                if (path.isFile()) {
                    if (path.getName().equals(whatImLookingFor))
                        System.out.println(path.getCanonicalPath());
                else
                    if (path.isDirectory()) {
                        File[] currentFiles = path.listFiles();
                        for (int i=0; i<currentFiles.length; i++)
                            recursivelySearch(currentFiles, whatImLookingFor);
    catch(IOException ioe) {
    System.out.println("During search got error "+ioe.getMessage());
    public static void main(String[] args) {
    new Main();

  • Reading file name

    hello
    i used the step by step guide to develop a module for reading file name in a sender file adapter from Krishnakumar Ramamoorthy. (Thankyou very much for that guide)
    now when i use this module i get only one problem:
    the filename includes the source-dir as well.
    e.g.
    source-dir: /home/example
    filename: test.txt
    Filename in module: /home/example/test.txt
    why is the source-path included in the Filename?
    thanks alot for any help

    Hi Paul,
    you can always delete this inside your mapping:
    for instance trim the first 13 letters from /home/example
    then if your directory is always the same you'll have a filename only
    Regards,
    michal

  • MDM Sender Channel - reading file name

    Hi all,
    Is there any simple way to read the name of file sent by MDM when I am using MDM sender adapter ?
    I know if it's file sender channel, then we can read file name by writing a UDF. But just wondering about MDM sender adapter.
    Regards,
    -Shankar

    Hi Paul,
    you can always delete this inside your mapping:
    for instance trim the first 13 letters from /home/example
    then if your directory is always the same you'll have a filename only
    Regards,
    michal

  • How to Read file name which we are dealing with ODI File tool

    Hi,
    We are using ODi10g version and we have requirement to move file from one place to another place. We are using ODIFileMove utility but we also want to read file name.
    Any help.
    Thanks in Advance.

    You can accomplish this with a fairly simple Jython script.  Use the os.listdir(<directory>) command to get the name of files in a given directory. 
    You can then (still in the Jython script) loop through the files and move them to a desired location (bypassing the OdiFileMove tool) OR use the Jython script to write the file names to a SQL table.  Then, use an ODI procedure to loop through the newly inserted records and store the file name in an ODI variable that you can then use in your OdiFileMove tool etc.
    I often refer to this blog entry from Gurcan Orhan as a starting point for this kind of task: Loading multiple files with ODI | Gurcan Orhan&amp;#039;s Oracle Data Integrator Blog

  • How to create Dynamic Selection List containg file names of a directory?

    Hi,
    I need a Selection List with a Dynamic List of Values containing all file names of a particular directory (can change through the time).
    Basically, I need an Iterator over all file names in a directory, which could be used for Selection List in a JSF form.
    This iterator has nothing to do with a database, but should get the names directly from the file system (java.io.File).
    Can anybody tell me how to create such an iterator/selection list?
    I am working with JDeveloper 10.1.3.2, JSF and Business Services.
    Thank you,
    Igor

    Create a class like this:
    package list;
    import java.io.File;
    public class fileList {
        public fileList() {
        public String[] listFiles(){
        File dir = new File("c:/temp");
        String[] files = dir.list();
        for (int i = 0; i < files.length; i++)  {
                System.out.println(files);
    return files;
    Right click to create a data control from it.
    Then you can drag the return value of the listFiles method to a page and drop as a table for example.
    Also note that the Content Repository data control in 10.1.3.2 has the file system as a possible data source.

  • Please Pull My Name From The Directory

    Can you please pull my Skype name from the directory?
    I've already removed all of my personal information and I would like to have my Skype removed from the directory.
    Thank you,
    -James

    Hi, James, and welcome to the Community,
    Just to ensure all of your i's are dotted and your t's are crossed, please review the information in this FAQ article:
    Can I Delete My Skype Account?
    and then please contact Skype Customer Service to file your request as indicated in the instructions.
    Regards,
    Elaine
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

Maybe you are looking for