<?php require_once "../src/Prods.inc.php"; $account = new RODSAccount("localhost", 1247, "rods", "rods", "tempZone"); $target_dir = '/tempZone/home/rods'; try { $start_time = microtime(true); $dir = new ProdsDir($account, $target_dir); $terms = array('descendantOnly' => true, 'recursive' => true); $total_count = 0; $results = $dir->findFiles($terms, $total_count); foreach ($results as $file) { echo $file->path_str . "\n"; } echo "Total: {$total_count} files"; $end_time = microtime(true); $exec_time = $end_time - $start_time; echo "--- test successful! in ({$exec_time} sec) --- <br/>\n"; } catch (RODSException $e) { echo "--- test failed! --- <br/>\n"; echo $e; echo $e->showStackTrace(); }
<?php require_once "/Path/to/Prods/src/Prods.inc.php"; // make an iRODS account object for connection, assuming: // username: demouser, password: demopass, server: srbbrick15.sdsc.edu, port: 1247 $account = new RODSAccount("srbbrick15.sdsc.edu", 1247, "demouser", "demopass"); //create an dir object, assuming the path is "/tempZone/home/demouser" $home = new ProdsDir($account, "/tempZone/home/demouser"); //search under home directory, recursively, by specified metadata: // any file with metadata "myname" has a value of "myvalue" $meta = new RODSMeta("myname", "myvalue", null, null, "="); $files = $mydir = $home->findFiles(array('descendantOnly' => true, 'recursive' => true, 'metadata' => array($meta))); // print the found files foreach ($files as $file) { echo "Found file: " . $file->getPath() . "\n"; }