* args[0]: the complete URL path to the directory
*
* @return Returns undefined; throws FileIOException if directory not found or if specified path is not a directory
*/
public Object execute( Object thiz, Object[] args ) throws Exception {
FileConnectionWrapper fConnWrap = null;
try {
fConnWrap = new FileConnectionWrapper( args[ 0 ].toString() );
if( !fConnWrap.exists() ) {
throw new FileIOException( FileIOException.DIRECTORY_NOT_FOUND );
}
if( !fConnWrap.isDirectory() ) {
throw new FileIOException( FileIOException.NOT_A_DIRECTORY );
}
// Delete all the contents of the directory if the flag is set
if( args.length > 1 && args[ 1 ] instanceof Boolean && args[ 1 ].toString().equals( "true" ) ) {
deleteEntireDirectory( fConnWrap );
} else {
fConnWrap.getFileConnection().delete();
}
} finally {
if( fConnWrap != null ) {
fConnWrap.close();
}
}
return UNDEFINED;
}