Capture Latest file in a directory

Dear All,
        I have a requirement that pulls data from flat file to sql Server table. In Source folder I have multiple number of files, sample file names are mentioned here   
File Names  in Folder: Sales_122513,Sales_122613,sales_122713
 Among all these files I need to process only Latest file i.e sales_122713
Can some one help on how can I get this one.
Regards,
Praveen C
Regards, Praveen

Thank you for your reply,
My solution:
Step 1: Created an ## teamp table
Create Table ##FileName(Id int Identity, FileName Varchar(500),DateValue varchar(20))
2: With the help of For each loop container captured file names and store those information into ##temp table.
3: Capture MMDDYY value from file name and convert that value into date by using below expression.
SELECT REPLACE(CONVERT(VARCHAR(10), (Select Max(cast(left(DateValue,2)+'-'+SUBSTRING(DateValue,3,2)+'-'+RIGHT(DateValue,2) as DATE)) from ##FileName), 1), '/', '')
4: With help of MAX function captured latest file from folder.
Regards,
Praveen C
Regards, Praveen

Similar Messages

  • Does creation of new xml file captures latest value?

    HI All,
    say for instance, if web port has been changed from 8000 to 80 and after this change xml file gets corrupted in apps tier...
    Does creation of new xml file in apps tier captures latest value of web port 80 and all other latest changes made so far?
    Thanks for your time...

    HI All,
    say for instance, if web port has been changed from
    8000 to 80 and after this change xml file gets
    corrupted in apps tier...
    Does creation of new xml file in apps tier captures
    latest value of web port 80 and all other latest
    changes made so far?
    Thanks for your time...If autoconfig is not run after the changes are made to the context file, and the file is lost then the changes are lost.

  • How do I choose the lates file from a directory in LabView? I want to use the latest file without having to choose it manually

    When a LabView program starts up, I want it to go to a directory and choose the latest file there. Is there a way to sort the files to get the latest?

    Hello,
    Check annex.
    Hope it helps,
    Paulo
    Attachments:
    LatestFile.vi ‏24 KB

  • How to Select the Latest file from Application Server?

    Dear All,
    I am working on object, which had requirement to Pick the file from application server.
    The Application server contain the files in ‘/temp/sms/’ directory. The files are having the name Like ‘smsqry_yyyymmddhhmmss.txt’ and I have to Pick the Latest file (Base on file name for eg. 'smsqry_20060713102333’) from that all and after getting the file I have to delete the file from application server.
    So How to do this.
    Regards

    hi,
    look function group EPSF-
    esp. fm EPS_GET_DIRECTORY_LISTING
    if you're looking fo OS-date and time
    look here:Re: How do I convert MTIME to date and time?
    A.
    Message was edited by: Andreas Mann

  • 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

  • Find the File name from directory

    Hi Experts,
    My Scenario is:
    Pick the file from the Directory, Based on the file name, get the Q information from R/3 system and place the file into MQ.
    My Question is : How can I get the file name?, any one please guide me..
    Thanks for your help,
    Thanks,
    SR

    HI SR
    You need to enable the Adapter-Specific Message Attributes
    enable the FileName under this. Enabling this will allow to have this parameter as XI header
    You can check this value is generated or not using SXMB_MONI -> Inbound message -> SOAP header  -> Dynamic Configuration.
    This will be captured under http://sap.com/xi/XI/System/File name =  FIleNameu201D
    Now code given by Anand above will allow you to use this FileName in mapping. Based on this you can check R/3 system for relevant file.
    Hope this make you confortable with filename concept
    Thanks
    Gaurav

  • Possibility of capturing data file name in SQL * Loader

    Hi,
    I have a requirement to capture the data file name in the staging table, is there a way that i can capture it in SQL * Loader or any other way of doing it.
    Need experts suggestion please.
    Thanks,
    Genoo

    Hi Genoo.
    how do we capture the file name and stores in the temporary table
    You may use the above command mentioned in my previous post (if Linux) to populate the Test.csv file with the available file name in the directory, i.e:
    ls /some/path/*.dat | xargs -n1 basename  > /home/oracle/Test.csv
    1. Ensure to first load the Test.csv file as for eg:
    1,aaa
    2,bbb
    3,ccc
    2. Create a control file to load these records into temporary tables,for eg:
    load data
    infile '/home/oracle/Test.csv'
    into table file_name_upload
    fields terminated by ","
    ( id, file_name )
    3. Create the respective table in the database:
    create table file_name_upload
      id number,
      file_name varchar2(20)
    4. Load the data into temporary table
    sqlldr test/test control=/home/oracle/sqlldr_test.ctl
    Please refer notes:
    SQL*Loader - How To Load A Date Column With Fractions Of Second (Doc ID 1276259.1)
    Script To Generate SQL*Loader Control File (Doc ID 1019523.6)
    SQL*Loader performance tips (Doc ID 28631.1)
    How To use the Sequence Function of SQL*Loader (Doc ID 1058895.6)
    How to Get Data from Existing Table to Flat File Usable by SQL*Loader (Doc ID 123852.1)
    Also see link:
    10 Oracle SQLLDR Command Examples (Oracle SQL*Loader Tutorial)
    Thanks &
    Best regards,

  • How to Capture the File Names of any extension using ssis

    Hello,
    Can you please let me know on how to Capture the File Names of any extension(EG : xls,text,.csv etc) at a time  and stores in excel file  using SSIS?
    Any help would be appreciated.
    Thanks,
    Vinay s

    If you need to act differently on each file type separately or if not all types of files are wanted, i.e. the Filespecifier cannot be *.* in the Foreach loop:
    In the ssis package
    make 3 variables:
    to store the file extension, e.g. User::CurrentExtension of type string
    to store the filename found in the directory: @CurrentFilename
    to store the name of the directory where the files reside e.g. User::CurrentDirectory
    make a foreach loop of type Foreach Item enumerator:
    in the items list you add each file extension that you need
    txt
    csv
    xls
    xlsx
    As Variable mappings map the CurrentExtension to Index 0
    Inside this foreach loop add another foreach loop of type Foreach File enumerator, in the collection Expressions
    add Expression Directory , set to @[User::CurrentDirecotry]
    add Expression FileSpec, set to "*." + @[User::CurrentFileExtension]
    In the Variable mappings, map Variable user::CurrentFilename to Index 0
    Inside this loop use Execute SQL Task to insert the filename in a Excel connection.
    Jan D'Hondt - SQL server BI development

  • Latest File in AL11

    In AL11, we have many files for the perticular interface in a perticular dedicated folder/directory.
    Out of these many files, I have to read the one that is latest.
    Any idea how do get the file name of the latest file?
    Thanks
    Edited by: Pranu Pranu on Jan 26, 2011 5:12 AM

    There is to method you can use.
    1. Use the OS kernal functions.
    get directory listing
    CALL 'C_DIR_READ_FINISH' " just to be sure
    ID 'ERRNO' FIELD files-errno
    ID 'ERRMSG' FIELD files-errmsg.
    CALL 'C_DIR_READ_START'
    ID 'DIR' FIELD dir_nam
    ID 'FILE' FIELD ''
    ID 'ERRNO' FIELD files-errno
    ID 'ERRMSG' FIELD files-errmsg.
    IF sy-subrc 0.
    *RAISE read_directory_failed.
    ENDIF.
    REFRESH files.
    CLEAR file_counter.
    CLEAR error_counter.
    DO. <<<<<<<<<<<<<<----
    Start Of reading a directory sequentially
    CLEAR files.
    files-dirname = dir_nam.
    CALL 'C_DIR_READ_NEXT'
    ID 'TYPE' FIELD files-type
    ID 'NAME' FIELD files-name
    ID 'LEN' FIELD files-len
    ID 'OWNER' FIELD files-owner
    ID 'MTIME' FIELD files-mtime
    ID 'MODE' FIELD files-mode
    ID 'ERRNO' FIELD files-errno
    ID 'ERRMSG' FIELD files-errmsg.
    IF sy-subrc = 0.
    *Here You can match the creation time of the file by comparing it with others
    IF <File is old then process with the next file>.
    CONTINUE.
    ELSEIF ( files-type(1) 'd' ) AND " <<<<----
    D indicated directories
    ( files-type(1) 'D' ).
    ADD 1 TO file_counter.
    files-subrc = '0'.
    PERFORM p6_to_date_time_tz(rstr0400)
    USING
    files-mtime
    files-mod_time
    files-mod_date.
    APPEND files.
    ENDIF.
    ELSEIF sy-subrc = 1.
    EXIT.
    ELSE.
    IF error_counter > 1000.
    CALL 'C_DIR_READ_FINISH'
    ID 'ERRNO' FIELD files-errno
    ID 'ERRMSG' FIELD files-errmsg.
    RAISE too_many_read_errors.
    ENDIF.
    ADD 1 TO error_counter.
    files-subrc = '18'.
    PERFORM p6_to_date_time_tz(rstr0400)
    USING
    files-mtime
    files-mod_time
    files-mod_date.
    APPEND files.
    ENDIF.
    ENDDO.
    CALL 'C_DIR_READ_FINISH'
    ID 'ERRNO' FIELD files-errno
    ID 'ERRMSG' FIELD files-errmsg.
    IF file_counter > 0.
    SORT files BY name ASCENDING.
    ELSE.
    *RAISE empty_directory_list.
    ENDIF.
    And Finally You can use the FILES table to get the latest file name.
    2. Another method go with function module EPS_GET_DIRECTORY_LISTING and collect all file in output table and use some file information function module like EPS_GET_FILE_ATTRIBUTES or following kernal method to compare every file creation date and time and get the latest file out of that.
    CALL 'C_FILE_ATTRIBUTES'
              ID 'NAME'   FIELD file_path
              ID 'TYPE'   FIELD file-type
              ID 'LEN'    FIELD file-len
              ID 'OWNER'  FIELD file-owner
              ID 'MTIME'  FIELD file-mtime
              ID 'MODE'   FIELD file-mode
              ID 'ERRNO'  FIELD file-errno
              ID 'ERRMSG' FIELD file-errmsg.
    Cheers
    Dhirendra Pandit

  • Error in sender file adapter: source directory does not exist

    Hi,
    The PI system is 7.11
    I've created sender file adapter with following details:
    Transport Protocol : File System
    Source directory: /interfaces/In
    I checked in AL11 that this path really exists and it does. (I can even see the .txt file that should be processed.)
    But still i get in Communication Channel Monitoring the following error:
    "Configured Source directory "/interfaces/In" does not exist.
    (i also tried to give the source directory as "interfaces/In" and as "//interfaces/In" but still the same error.
    Any suggestions as to what is wrong?
    kr
    Robert

    Actually, Need to use forward slash (/) to separate directory names in accordance with the Java specification.
    But wanted to try if that works..
    Also check directory name , path again as this is case sensitive...
    --Divyesh

  • File to dinamic directory

    Hi all.
    i have an XML that contain:
    FILE:Sales.xml
    Directory:c:\new folder
    Name: Rodrigo
    LastName: Suarez
    Age: 21
    I must map it to an another File to c:\new folder\Sales.xml
    my problem is File and Directory is dinamic--> Directory an File can change
    Any Idea How can i do it??
    Thanks & Regads
    Rodrigo

    hi Jin
    im trayin do a UDF enconding, but in dont know how to do that. I Created a User Function.
    Imports: com.sap.aii.mapping.api.DynamicConfigurationKey;com.sap.aii.mapping.api.DynamicConfiguration;
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey keyF = DynamicConfigurationKey.create( URLFile, "FileName");
    DynamicConfigurationKey keyD = DynamicConfigurationKey.create( URLFile, "Directory");
    String valueOld = conf.get(keyF);
    String valueOldD = conf.get(keyD);
    if (valueOld != null) {
        String valueNew = valueOld.replaceAll("Sender.xml",file);
        conf.put(keyF, valueNew);
    if (valueOldD != null) {
        String valueNewD = valueOldD.replaceAll("/IN",dir);
        conf.put(keyD, valueNewD);
    return name;
    URLFile: http://sap.com/xi/XI/System/File.
    I dont know if the logic of function is right.
    I made a Test in XI and the result was this:
    Compilation of dynamic_directory_MM successful Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._dynamic_directory_MM_ method FileCOutput$[http://sap.com/xi/XI/System/File, Sales.xml, c:/, Rodrigo, com.sap.aii.mappingtool.tf3.rt.Context@9159fe] com.sap.aii.utilxi.misc.api.BaseRuntimeException: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._dynamic_directory_MM_ method FileCOutput$[http://sap.com/xi/XI/System/File, Sales.xml, c:/, Rodrigo, com.sap.aii.mappingtool.tf3.rt.Context@9159fe]
    Regards
    RP

  • How do i delete Older files from the directory before create a new file?

    Hi,
    How do i delete older files in a particular directory,
    the senorio is count the number of .txt files in a directory and delete the older files if file count is more than 10. (if i add 11th file the very first file has to be deleted)
    i have written the code to count the files and delete , but it is deleting all the files instead of older file
    public class ExtensionFilter implements FilenameFilter {
      private String extension;
      public ExtensionFilter( String extension ) {
        this.extension = extension;            
      public boolean accept(File dir, String name) {
        return (name.endsWith(extension));
    public class FileUtils{
      public static void main(String args[]) throws Exception {
        FileUtils.deleteFiles("c:/countfile/", ".txt");
      public static void deleteFiles( String directory, String extension ) {
        ExtensionFilter filter = new ExtensionFilter(extension);
        File dir = new File(directory);
        String[] list = dir.list(filter);
        File file;
        if (list.length == 0) return;
        for (int i = 0; i < list.length; i++) {
          //file = new File(directory + list);
    file = new File(directory, list[i]);
    if ((list[i]).length()>=10)
         System.out.print(file + " deleted : " + file.delete());
    Thanks,
    Jamin Rosina                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    What your code is doing now, is deleting all filenames that are longer than 10 characters.
    Your problem lies in the line:
    if ((list).length()>=10)

  • Anyone knows how to delete a file from a directory?????

    hi there
    anyone has any idea on how to delete a file from a directory? delete(String filename)? thank you.

    Hi,
    Check this link.
    Gives you an example code to show how to delete a file.
    http://examples.oreilly.com/jenut/Delete.java
    Hope this helps.
    Roopasri Vittal
    Developer Technical Support
    Sun Microsystems
    http://sun.com/developers/support

  • How do I delete a file from a directory

    I want to delete the file I have finished processing in the c:\upload directory but the f.delete() command is not working. Am I using this command correctly?
    The f.delete() is after I copy the file to an archive directory.
    Program:
    import java.io.*;
    import java.util.*;
    import java.text.*;
    import java.sql.*;
    public class ReadSource {
    public static void main(String[] args) throws Exception {
         StringTokenizer st1;
              String val1, val3, val4, val5, val9, val10, val11, val12, val13, val14, val16;
              String val2, val6, val7, val8, val15, val17, val18, val19, val20;
              int cnt;
              File f = new File("C://upload" );
              FileWriter outFile = new FileWriter("C://RIFIS/log/logfile.txt", true);
              String filetext = "Starting RIFIS Upload";
              java.util.Date d = new java.util.Date();
              SimpleDateFormat form = new SimpleDateFormat("dd/MMM/yyyy hh:mm:ss");
              String dateString = form.format(d);
         try {
              Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@xxxxx.xxxx.xxx:1521:xx","xxxxxx","xxxx");
                        Statement st = conn.createStatement();
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write(filetext+" - "+dateString);
                        if (f.isDirectory())
                        { String [] s = f.list();
                        for (int i=0; i<s.length; i++)
                        { outFile.write(System.getProperty("line.separator"));
                             outFile.write("Found file - "+f+"/"+s);
              FileReader file = new FileReader(f+"/"+s[i]);
                                  File inputFile = new File(f+"/"+s[i]);
                                  File outputFile = new File("C://RIFIS/archive/"+s[i]);
                        BufferedReader buff = new BufferedReader(file);
                        boolean eof = false;
                        String val0="";
                        ResultSet rec = st.executeQuery("SELECT landings_hold_batch_seq.nextval FROM dual");
                        while(rec.next())
                        { val0 = rec.getString(1); }
                                  cnt=0;
                        while (!eof)
                        { String line = buff.readLine();
                             if (line == null)
                             { eof = true; }
                             else
                             { //System.out.println(line);
                                       cnt = cnt+1;
                                  st1 = new StringTokenizer(line,",");
                                       val1 = st1.nextToken();
                                       val2 = st1.nextToken();
                                       val3 = st1.nextToken();
                                       val4 = st1.nextToken();
                                       val5 = st1.nextToken();
                                       val6 = st1.nextToken();
                                       val7 = st1.nextToken();
                                       val8 = st1.nextToken();
                                       val9 = st1.nextToken();
                                       val10 = st1.nextToken();
                                       val11 = st1.nextToken();
                                       val12 = st1.nextToken();
                                       val13 = st1.nextToken();
                                       val14 = st1.nextToken();
                                       val15 = st1.nextToken();
                                       val16 = st1.nextToken();
                                       val17 = st1.nextToken();
                                            val18 = st1.nextToken();
                                            val19 = st1.nextToken();
                                            val20 = st1.nextToken();
                                       /*System.out.println("Token 0: " + val0);
                                  System.out.println("Token 1: " + val1);
                                  System.out.println("Token 2: " + val2);
                                       System.out.println("Token 3: " + val3);
                                       System.out.println("Token 4: " + val4);
                                       System.out.println("Token 5: " + val5);
                                       System.out.println("Token 6: " + val6);
                                       System.out.println("Token 7: " + val7);
                                       System.out.println("Token 8: " + val8);
                                       System.out.println("Token 9: " + val9);
                                       System.out.println("Token 10: " + val10);
                                       System.out.println("Token 11: " + val11);
                                       System.out.println("Token 12: " + val12);
                                       System.out.println("Token 13: " + val13);
                                       System.out.println("Token 14: " + val14);
                                       System.out.println("Token 15: " + val15);
                                       System.out.println("Token 16: " + val16);
                                       System.out.println("Token 17: " + val17);
                                            System.out.println("Token 18: " + val18);
                                            System.out.println("Token 19: " + val19);
                                            System.out.println("Token 20: " + val20);*/
                                       st.executeUpdate("INSERT INTO LANDINGS_HOLD (lh_id, lh_batch, supplier_dr_id, supplier_unique_id, supplier_dealer_id, supplier_cf_id, supplier_vessel_id, unload_year, unload_month, unload_day, state_code, county_code, port_code, itis_code, market, grade, reported_quantity, unit_measure, dollars, lh_loaddt, lh_loadlive, purch_year, purch_month, purch_day)" +
                        "VALUES (0,'"+val0+"','"+val1+"',"+val2+",'"+val3+"','"+val4+"','"+val5+"',"+val6+","+val7+","+val8+",'"+val9+"','"+val10+"','"+val11+"','"+val12+"','"+val13+"','"+val14+"',"+val15+",'"+val16+"',"+val17+",SYSDATE,NULL,"+val18+","+val19+","+val20+")");
                             FileReader in = new FileReader(inputFile);
                             FileWriter out = new FileWriter(outputFile);
    int c;
                             while ((c = in.read()) != -1)
                             { out.write((char)c); }
                             in.close();
                             out.close();
                             outFile.write(System.getProperty("line.separator"));
                             outFile.write("Number of records inserted - "+cnt);
                             outFile.write(System.getProperty("line.separator"));
                             outFile.write("Copied upload file to archive directory");
                             f.delete(); // delete the upload file
                             outFile.write(System.getProperty("line.separator"));
                             outFile.write(f+"/"+s[i]+" - Has been removed from upload directory");
                             buff.close();
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write("Upload Complete...NO ERRORS");
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write("*************************************************************");
                        outFile.write(System.getProperty("line.separator"));
                        //outFile.flush();
              //outFile.close();
                        conn.close();
                        else
                        { outFile.write("No files to process"); }
              catch(Exception e)
                   { outFile.write(System.getProperty("line.separator"));
                   outFile.write("ALERT....ALERT....ALERT");
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write("Error Occurred in ReadSource.java - RIFIS Upload");
                        outFile.write(System.getProperty("line.separator"));
                   outFile.write("My Error: " + e);
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write("*************************************************************");
                   outFile.flush();
              outFile.close();

    Gave it a try but file c:\upload\DS121002.csv did not go away. Here is the location of my delete command:
    st.executeUpdate("INSERT INTO LANDINGS_HOLD (lh_id, lh_batch, supplier_dr_id, supplier_unique_id, supplier_dealer_id, supplier_cf_id, supplier_vessel_id, unload_year, unload_month, unload_day, state_code, county_code, port_code, itis_code, market, grade, reported_quantity, unit_measure, dollars, lh_loaddt, lh_loadlive, purch_year, purch_month, purch_day)" +
                        "VALUES (0,'"+val0+"','"+val1+"',"+val2+",'"+val3+"','"+val4+"','"+val5+"',"+val6+","+val7+","+val8+",'"+val9+"','"+val10+"','"+val11+"','"+val12+"','"+val13+"','"+val14+"',"+val15+",'"+val16+"',"+val17+",SYSDATE,NULL,"+val18+","+val19+","+val20+")");
                             FileReader in = new FileReader(inputFile);
                             FileWriter out = new FileWriter(outputFile);
    int c;
                             while ((c = in.read()) != -1)
                             { out.write((char)c); }
                             in.close();
                             out.close();
                             inputFile.delete();
                             outFile.write(System.getProperty("line.separator"));
    ............

  • Java Program to copy file from one directory to another failing

    Hello All,
    Oracle Applications 12.1.3
    RDBMS: 11.2.0.30
    SQL*Plus: 10.1.0.5.0
    Java beginner here so help is much appreciated.  I'm have some java code that I'm using to copy a file from one directory to another in an Oracle Applications Server.  I notice that when moving to a new instnace I started to get file not found errors.  I think it's because of the directory.  My question is, does the directory in which I trying to pick up the file have to be a DBA_DIRECTORY, or a UTL_FILE directory in order for the java to find the file and move it?
    Here is my code...
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "COPY_FILE_JVS" AS
    import java.io.*;
    public class COPY_FILE_JVC{
      public static void copy(String SourceFile, String DestDir) {
        File source = new File(SourceFile);
        File dest = new File(DestDir);
        File cpDestFile = null;
        try {
          if (dest.isDirectory()) {
              if(source.isFile()) {
                System.out.println("File name = " + source.getName());
                System.out.println("File name dest = " + dest.getPath() );
                System.out.println("File name cpDestFile = " + dest.getPath() + File.separator + source.getName());
                cpDestFile = new File(dest.getPath() + File.separator + source.getName());
              else {
                System.out.println("Directory or File Not Found");
                return;
          BufferedInputStream  br = new BufferedInputStream (new FileInputStream (source));
          BufferedOutputStream  bw = new BufferedOutputStream (new FileOutputStream (cpDestFile));
          int read = 0;
          while((read = br.read()) != -1) {
            //System.out.println((char)read);
            bw.write(read);
          br.close();
          bw.close();
        catch (FileNotFoundException e) {
        e.printStackTrace();
        catch (IOException e) {
        e.printStackTrace();

    I get these messages when calling the java from SQL Plus as follows...
    serveroutput on size 100000;
    dbms_java.set_output(1000000);
    MY_PKG.CopyFile('/home/my_user/set_env.sh','/interface/home'); (this is call to oracle pl/sql package which calls the java.)
    PL/SQL procedure successfully completed.
    Directory or File Not Found
    PL/SQL procedure successfully completed.
    If I change the directory from /home/my_user/ to any directory that is defined in DBA_DIRECTORIES or is a UTL_FILE directory to program works.  Is it perhaps because the java is in a PL/SQL package as seen below?  The PL/SQL program runs as the APPS user and I have issued the following the command grant JAVASYSPRIV to APPS.
    Here is the PL/SQL Package....
    CREATE OR REPLACE PACKAGE BOLINF.MY_PKG AUTHID CURRENT_USER AS
    CopyFile(p_SourceFile IN VARCHAR2, p_DestDir IN VARCHAR2);
    +++++++++++++++++++++++++++++
    CREATE OR REPLACE PACKAGE BODY BOLINF.MY_PKG  is
    CopyFile(p_SourceFile IN VARCHAR2, p_DestDir IN VARCHAR2)
    AS LANGUAGE JAVA NAME 'COPY_FILE_JVC.copy(java.lang.String, java.lang.String)';

Maybe you are looking for

  • Fit the image to window width, window height and  the window size

    hi all here we wrote the code for "fit the image to window width, window height and the window size". we are facing some problems in it. and all these operations have to perform even after zooming operations are done.if the below code doesnt satisfy

  • Error in SAP BPC

    Hi Experts, We are facing a strange error while sending data from input Schedule in SAP BPC 7.5 SP08. For Reporting Currency USD, we are able to send data from the input schedule but from reporting currency EUR we are getting the error "Error running

  • Connecting iPod to stereo with fiber optic cable???

    My kingdom for the right answer to this question. I'm brand new to the whole iPod scene. Just bought an 80GB video iPod and I want to use it with my stereo system instead of the old bulky 200 CD carousel. I see that I can connect the iPod and stereo

  • Configuration Management Software

    Hi all, I'm putting it out there early. In two weeks (Dec 14th) I am going to release rConfig. This free and open source software has been over a year in the making and is specifically designed by a highly expereinced network engineer (Me!) for netwo

  • Can anydata be converted to RAW?

    I am looking for a possible workaround for the current limitation in accessing anydata via db link. This particular anydata cannot exceed size of 32K. If I could somehow cast it to RAW, get it via remote plsql procedure and than cast it back to ANYDA