Home > mls  [1 example]

List contents of multiple remote directories.

 Examples

SET SERVEROUTPUT ON SIZE 1000000;
SET LINES 255;
DECLARE
  fid VARCHAR2(80);
  host VARCHAR2(80)   := 'ftp.gnu.org';
  usernm VARCHAR2(80) := 'anonymous';
  passwd VARCHAR2(80) := '';
  lv_result VARCHAR2(32767);
  l_list1 fclient_p.name_type;
  l_list2 fclient_p.name_type;
BEGIN
  fid := fclient_p.createFTPClient;
  fclient_p.login(fid, host, usernm, passwd);

  -- Want to list file names within the following directories: /gnu/time and /gnu/windows
  DBMS_OUTPUT.PUT_LINE('Files in /gnu/time');
  lv_result := fclient_p.nameListStreamPath(fid, '/gnu/time');
  l_list1 := fclient_p.convertNameListToTables(lv_result);
  FOR i IN 1..l_list1.COUNT LOOP
    DBMS_OUTPUT.PUT_LINE('name : '||l_list1(i));
  END LOOP;

  DBMS_OUTPUT.PUT_LINE('Files in /gnu/windows');
  lv_result := fclient_p.nameListStreamPath(fid, '/gnu/windows');
  l_list2 := fclient_p.convertNameListToTables(lv_result);
  FOR i IN 1..l_list2.COUNT LOOP
    DBMS_OUTPUT.PUT_LINE('name : '||l_list2(i));
  END LOOP;

  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;
/

Output: Files in /gnu/time name : /gnu/time/index.html name : /gnu/time/time-1.7.tar.gz Files in /gnu/windows name : /gnu/windows/emacs name : /gnu/windows/index.html

 Related Commands
 ls
 mdelete
 mget
 
© 1999-2003 Bear Claw Inc.