Home > mdir  [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.list_type;
  l_list2 fclient_p.list_type;
BEGIN
  fid := fclient_p.createFTPClient;
  fclient_p.login(fid, host, usernm, passwd);

  -- Want to list contents of the following directories: /gnu/time and /gnu/windows
  DBMS_OUTPUT.PUT_LINE('Listing of /gnu/time');
  lv_result := fclient_p.listStreamPath(fid, '/gnu/time');
  l_list1 := fclient_p.convertDetailListToTables(lv_result);
  FOR i IN 1..l_list1.COUNT LOOP
    IF l_list1(i).dir THEN
      DBMS_OUTPUT.PUT_LINE('dir : '||l_list1(i).file||'  date: '||l_list1(i).dy||'-'||l_list1(i).mth||'-'||l_list1(i).yr||' '||l_list1(i).tim);
    ELSE
      DBMS_OUTPUT.PUT_LINE('file: '||l_list1(i).file||'  date: '||l_list1(i).dy||'-'||l_list1(i).mth||'-'||l_list1(i).yr||' '||l_list1(i).tim);
    END IF;
  END LOOP;

  DBMS_OUTPUT.PUT_LINE('Listing of /gnu/windows');
  lv_result := fclient_p.listStreamPath(fid, '/gnu/windows');
  l_list2 := fclient_p.convertDetailListToTables(lv_result);
  FOR i IN 1..l_list2.COUNT LOOP
    IF l_list2(i).dir THEN
      DBMS_OUTPUT.PUT_LINE('dir : '||l_list2(i).file||'  date: '||l_list2(i).dy||'-'||l_list2(i).mth||'-'||l_list2(i).yr||' '||l_list2(i).tim);
    ELSE
      DBMS_OUTPUT.PUT_LINE('file: '||l_list2(i).file||'  date: '||l_list2(i).dy||'-'||l_list2(i).mth||'-'||l_list2(i).yr||' '||l_list2(i).tim);
    END IF;
  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: Listing of /gnu/time file: index.html date: 11-Jul-1996 00:00 file: time-1.7.tar.gz date: 11-Jul-1996 00:00 Listing of /gnu/windows dir : emacs date: 22-Mar-2003 17:58 file: index.html date: 24-Mar-2003 23:00

 Related Commands
 ls
 modtime
 
© 1999-2003 Bear Claw Inc.