Home > mkdir  [2 examples]

Make directory on the remote machine.

 Examples

Ex. 1. Make a directory within the current working directory.
Ex. 2. Make any directory.


Ex. 1.  Make a directory within the current working directory.
SET SERVEROUTPUT ON SIZE 1000000;
DECLARE
  fid VARCHAR2(80);
  host VARCHAR2(80)   := '[replace with ftp address]';
  usernm VARCHAR2(80) := '[replace with ftp username]';
  passwd VARCHAR2(80) := '[replace with ftp password]';
BEGIN
  fid := fclient_p.createFTPClient;
  fclient_p.login(fid, host, usernm, passwd);

  fclient_p.makeDirectory(fid, 'test99');

  fclient_p.logout(fid);
  fclient_p.remove(fid);
EXCEPTION
  WHEN fclient_p.java_failed THEN
    DBMS_OUTPUT.PUT_LINE(SUBSTR(fclient_p.getErrorWithResponse(fid), 1, 255));
END;
/


Ex. 2.  Make any directory.
SET SERVEROUTPUT ON SIZE 1000000;
DECLARE
  fid VARCHAR2(80);
  host VARCHAR2(80)   := '[replace with ftp address]';
  usernm VARCHAR2(80) := '[replace with ftp username]';
  passwd VARCHAR2(80) := '[replace with ftp password]';
BEGIN
  fid := fclient_p.createFTPClient;
  fclient_p.login(fid, host, usernm, passwd);

  fclient_p.makeDirectory(fid, '/home/tester/test89/test99');

  fclient_p.logout(fid);
  fclient_p.remove(fid);
EXCEPTION
  WHEN fclient_p.java_failed THEN
    DBMS_OUTPUT.PUT_LINE(SUBSTR(fclient_p.getErrorWithResponse(fid), 1, 255));
END;
/

If you need to check if makeDirectory is successful add the following snippet of code immediately after the call to makeDirectory: IF fclient_p.getLastResponseReturnCode(fid) = '257' THEN DBMS_OUTPUT.PUT_LINE('Successful'); ELSE DBMS_OUTPUT.PUT_LINE(SUBSTR('Failed, Reason :'||REPLACE(fclient_p.getLastResponse(fid), CHR(10)), 1, 255)); END IF;

© 1999-2003 Bear Claw Inc.