2 Replies Latest reply: Jan 9, 2013 7:36 AM by HamidHelal RSS

    Rename File in Oracle Forms before Copy to another drive

    G.Y
      Dear All Seniors
      I want to ask that how to rename file before copy it to other drive.
      Actually when we get file from drive to open then it that time before copying I want to rename it.
      ------this code i am using for copying file from first path to other.
      DECLARE
      filename VARCHAR2(500);
      BEGIN
      filename := GET_FILE_NAME( File_Filter => 'Files (*.*)|*.*|');
      READ_IMAGE_FILE(filename, 'any', 'IMAGE6');
      HOST ('xcopy "'|| filename ||'" \\172.172.0.4\Combo_pic\',no_screen);
      END;
      I am using this code it is working fine, but i did't know how to use it before copying file.
      host('cmd /c rename "'||:block3.file_name||'" " '||:block3.file_name_n||' " '); --- for file rename

      thanks.
        • 1. Re: Rename File in Oracle Forms before Copy to another drive
          Askdineshsingh
          write your code in following sequence

          DECLARE
          filename VARCHAR2(500);
          BEGIN
          filename := GET_FILE_NAME( File_Filter => 'Files (*.)|.*|');
          READ_IMAGE_FILE(filename, 'any', 'IMAGE6');
          --rename the file at old location itself only
          HOST('RENAME '||FILENAME||' '||:block3.file_name_n, no_screen);
          --NOW COPY THE renamed file to your destination location
          HOST ('xcopy "'|| :block3.filename||'" \\172.172.0.4\Combo_pic\',no_screen);
          END;

          if this is helpful then mark it correct
          • 2. Re: Rename File in Oracle Forms before Copy to another drive
            HamidHelal
            Ghulam Yassen wrote:
            Dear All Seniors
            I want to ask that how to rename file before copy it to other drive.
            Actually when we get file from drive to open then it that time before copying I want to rename it.
            ------this code i am using for copying file from first path to other.
            DECLARE
            filename VARCHAR2(500);
            BEGIN
            filename := GET_FILE_NAME( File_Filter => 'Files (*.*)|*.*|');
            READ_IMAGE_FILE(filename, 'any', 'IMAGE6');
            HOST ('xcopy "'|| filename ||'" \\172.172.0.4\Combo_pic\',no_screen);
            END;
            I am using this code it is working fine, but i did't know how to use it before copying file.
            host('cmd /c rename "'||:block3.file_name||'" " '||:block3.file_name_n||' " '); --- for file rename
            Dear Ghulam Yassen,
            As salamualikum
            >HOST ('xcopy "'|| filename ||'" \\172.172.0.4\Combo_pic\',no_screen);
            Change the above line by the following line. It will rename as well as copy.
            HOST ('xcopy "'|| filename ||'" \\172.172.0.4\Combo_pic\'||:EMP_CODE||'.jpg',no_screen); ---here EMP_CODE is a column value.
            Above code will rename to emp_code value.


            Hope this works...

            Hamid