Get file if remote file is newer than local file.
| Examples |
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]';
l_local_dt DATE;
l_remote_dt DATE;
lv_remote_file VARCHAR2(80) := '/home/tester/testclasses.jar';
lv_local_file VARCHAR2(80) := 'c:\test.jar';
BEGIN
fid := fclient_p.createFTPClient;
fclient_p.login(fid, host, usernm, passwd);
l_local_dt := fclient_p.localmodtime(lv_local_file);
fclient_p.remoteModTime(fid, lv_remote_file);
l_remote_dt := TO_DATE(fclient_p.getLastResponseString(fid), 'YYYYMMDDHH24MISS');
DBMS_OUTPUT.PUT_LINE('local file: '||TO_CHAR(l_local_dt, 'DD-MON-YYYY HH24:MI:SS'));
DBMS_OUTPUT.PUT_LINE('remote file: '||TO_CHAR(l_remote_dt, 'DD-MON-YYYY HH24:MI:SS'));
IF l_remote_dt > l_local_dt THEN
DBMS_OUTPUT.PUT_LINE('NEWER');
fclient_p.representationType(fid, fclient_p.getIMAGE_TYPE);
fclient_p.retrieveStream(fid, lv_remote_file, lv_local_file);
END IF;
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:
local file: 03-APR-2003 10:15:29
remote file: 10-APR-2003 21:10:19
NEWER
| Related Commands |
modtime© 1999-2003 Bear Claw Inc.