Monday, May 16, 2011

How to Delete a File from the O/S from oracle developer Forms ?

How to Delete a File from the O/S from oracle developer Forms ?
---------------------------------------------------------------
1)

The first way to delete a file on the O/S is to use the HOST command. The HOST
built-in allows to execute an indicated operating system command.

Syntax (see forms on-line help)

PROCEDURE HOST(system_command_string VARCHAR2);
PROCEDURE HOST(system_command_string VARCHAR2,screen_action NUMBER);


On a Windows platform your code would look like :

HOST ( 'del C:\temp\temp1.lis', NO_SCREEN );

On a Unix platform you code would look like :

HOST ( 'rm /tmp/temp1.lis', NO_SCREEN );


As this solution is based on the HOST command it applies to all platforms.


2).

Another way to delete a file form the O/S is to use for Client/Server
D2kWutil: WIN_API_UTILITY.DELETE_FILE
or for Webforms
webUtil: webutil_file.delete_file.

1 comment:

Unknown said...

HOST('cmd /c del D:\Slips\\*.pdf',NO_SCREEN);