
set serverout on size unlimited;
exec dbms_java.set_output(2000000);
set define off


-- List all zip files in H:\Incoming directory (must have grant read on the dir...), no hash nor Mime Type computation
select *
from table(LIST_FILES(iDirectory => 'H:\Incoming', -- The dir
	iMatchStrIngRegExp => '.*zip',-- All zip files
	iJackSumAlgorithm => NULL,
	iJacksumEncodIng => NULL,
	iJacksumSeparator => NULL,
	iJacksumFormat => NULL,
	iJacksumGroupingIndex => -1,
	iJacksumGroupingSymbol => NULL,
	igetMimeType  => 0
	));
	
-- List all files in H:\Incoming directory (must have grant read on the dir...), no hash nor Mime Type computation
select *
from table(LIST_FILES(iDirectory => 'H:\Incoming', -- The dir
	iMatchStrIngRegExp => NULL,-- All files
	iJackSumAlgorithm => NULL,
	iJacksumEncodIng => NULL,
	iJacksumSeparator => NULL,
	iJacksumFormat => NULL,
	iJacksumGroupingIndex => -1,
	iJacksumGroupingSymbol => NULL,
	igetMimeType  => 0
	));

-- List all files in H:\Incoming directory (must have grant read on the dir...), compute crc32 and Mime Types
select *
from table(LIST_FILES(iDirectory => 'H:\Incoming', -- The dir
	iMatchStrIngRegExp => NULL,-- All files
	iJackSumAlgorithm => 'crc32',
	iJacksumEncodIng => 8,
	iJacksumSeparator => NULL,
	iJacksumFormat => '#CHECKSUM',
	iJacksumGroupingIndex => -1,
	iJacksumGroupingSymbol => NULL,
	igetMimeType  => 1
	));

-- make some stats on object types	
select decode(is_file_directory, 0, 'File', 1, 'Directory') "Type",
	count(*) "Nb Items"
from table(LIST_FILES(iDirectory => 'H:\Incoming', -- The dir
	iMatchStrIngRegExp => NULL,			-- All files
	iJackSumAlgorithm => NULL,			-- No Checksum
	iJacksumEncodIng => NULL,
	iJacksumSeparator => NULL,
	iJacksumFormat => NULL,
	iJacksumGroupingIndex => -1,
	iJacksumGroupingSymbol => NULL,
	igetMimeType  => 0					-- No Mime Type computation
	))
group by is_file_directory;