Home » Developer & Programmer » Forms » Copy Files and folders from one location to another
Copy Files and folders from one location to another [message #150367] Wed, 07 December 2005 10:20 Go to next message
olugbenga_oyeneye
Messages: 23
Registered: September 2005
Location: Lagos
Junior Member

I wrote the procedure below the displays a progress bar(Details below):


-------------------PROCEDURE SHOW_PROGRS--------
PROCEDURE SHOW_PROGRS( MIN_VALUE in Number, MAX_VALUE in Number) is
var1 varchar2(100);

BEGIN
FOR i in MIN_VALUE..MAX_VALUE loop
:PROGRESS_BAR:=null;

var1:= ROUND((i/max_value)*100);

:Position := var1||'%'; /* display item(:Position) displays the persentage of 'i'*/

var1 := RPAD(var1,var1,'|'); /* concat character '|' is the progress, here you can use '*' or any other suitable character */

--var1:=(substr(var1,4,100)||'|||'); /*this line is optional*/
:PROGRESS_BAR := (:PROGRESS_BAR||var1); /* display item(:PROGRESS_BAR) is the progress bar */

Synchronize;

:text_item26 := to_char(i); /* text item(:text_item26) displays the value of 'i' as it progresses */
end loop;
END;
------end PROCEDURE SHOW_PROGRS-----------------

--------when-botton-pressed-trigger-------------------

SHOW_PROGRS(1,1000); -- you can pass any value from 0..infinity

--------end when-botton-pressed-trigger-------------------


Now I want to copy files and Folders from location c:\ to location d:\ so that my progress bar will read the size of the source files and folder, copy the source files and folders to the destination drive or folder, calculate the progress using my progress bar also and dispay the progress bar.

I tried the code below but it did not work:
-----------------------begining-----------------------
PROCEDURE CopyFiles IS
v_source varchar2(3999):='c\:test.txt';
v_destination varchar2(3999):='D:\';
BEGIN
COPY (v_source,v_destination);
END;
---------------end-----------

I use Oracle9iDS.
I will appreciate your usual kind response.
Thank you.
-oyeneye_olugbenga
Re: Copy Files and folders from one location to another [message #150437 is a reply to message #150367] Wed, 07 December 2005 19:41 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
The 'copy' command is for copying one Form's item to another Form's item. If you want to copy files then I suggest ou use the 'host' command and invoke the operating system copy that way. To see the size of a file use a 'host' command the direct a 'dir' command to a flat file, use 'utl_file' to read it and add up the size of each file, and do the mathematics from there.

David
Re: Copy Files and folders from one location to another [message #150778 is a reply to message #150437] Fri, 09 December 2005 11:52 Go to previous messageGo to next message
olugbenga_oyeneye
Messages: 23
Registered: September 2005
Location: Lagos
Junior Member

I am looking for codes that will not be platform dependent though...

...and the only 'Host' i have used is Host import/export and Host variables.

Could u pls give me some sample codes where 'Host' is used to access the Operating system's commands.

I will appreciate it.

Thank you.

olugbenga_oyeneye
Re: Copy Files and folders from one location to another [message #150910 is a reply to message #150778] Sun, 11 December 2005 23:29 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Please search this forum for 'host' - there are many examples.

Quote:

I am looking for codes that will not be platform dependent though...
Unfortunately as directory structures are platform dependent you will need to write code for each platform type, test for the type of platform on which you are working, and execute the appropriate code.

David
Previous Topic: Batch Processing in Forms
Next Topic: DBMS_SQL: DEFINE_ARRAY and COLUMN_VALUE problem in FORMS 6i
Goto Forum:
  


Current Time: Fri Sep 20 05:32:34 CDT 2024