Changeset 28560 for main/trunk/greenstone2/bin
- Timestamp:
- 2013-10-30T20:54:49+13:00 (10 years ago)
- Location:
- main/trunk/greenstone2/bin/script
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/bin/script/explode_metadata_database.pl
r27901 r28560 14 14 use encodings; 15 15 use extrametautil; 16 use util; 17 use FileUtils; 16 18 use printusage; 17 19 use parse2; … … 87 89 'type' => "string", 88 90 # parsearg left "" as default 89 #'deft' => & util::filename_cat($ENV{'GSDLHOME'}, "collect"),91 #'deft' => &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "collect"), 90 92 'deft' => "", 91 93 'reqd' => "no", … … 349 351 350 352 # Explode means just that: the original file is deleted 351 & util::rm($filename);353 &FileUtils::removeFiles($filename); 352 354 $plugobj->clean_up_after_exploding(); 353 355 … … 364 366 die "Error: document directory $documents_directory already exists (bailing).\n"; 365 367 } 366 & util::mk_dir($documents_directory);367 368 my $documents_metadata_xml_file = & util::filename_cat($documents_directory, "metadata.xml");368 &FileUtils::makeDirectory($documents_directory); 369 370 my $documents_metadata_xml_file = &FileUtils::filenameConcatenate($documents_directory, "metadata.xml"); 369 371 if (-e $documents_metadata_xml_file) { 370 372 die "Error: documents metadata.xml file $documents_metadata_xml_file already exists (bailing).\n"; … … 427 429 # by first of all stripping any trailing slash and then always ensuring one is used through filename_cat 428 430 $document_prefix =~ s/(\/|\\)$//; 429 $document_file_full = & util::filename_cat($document_prefix, "$value$document_suffix");431 $document_file_full = &FileUtils::filenameConcatenate($document_prefix, "$value$document_suffix"); 430 432 } else { # the doc prefix may also contain the prefix of the actual *filename* following the directory 431 433 $document_file_full = $document_prefix . $value . $document_suffix; … … 560 562 $document_file_full =~ /([^\/]+)$/; 561 563 $document_file_name = $1; 562 $local_document_file = &util::filename_cat($documents_directory, $document_file_name); 564 $local_document_file = &FileUtils::filenameConcatenate($documents_directory, $document_file_name); 565 566 # the wget binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lions (android too?) 567 &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set 563 568 564 569 my $wget_options = "--quiet"; … … 576 581 else { 577 582 # convert the dirseps in filepath to correct dir sep for OS 578 $document_file_full = & util::filename_cat($document_file_full);583 $document_file_full = &FileUtils::filenameConcatenate($document_file_full); 579 584 my $dir_sep = &util::get_os_dirsep(); 580 585 … … 588 593 if (!$is_absolute) { 589 594 $document_file_full 590 = & util::filename_cat($orig_base_dir,$document_file_full);591 } 592 593 $local_document_file = & util::filename_cat($documents_directory, $document_file_name);595 = &FileUtils::filenameConcatenate($orig_base_dir,$document_file_full); 596 } 597 598 $local_document_file = &FileUtils::filenameConcatenate($documents_directory, $document_file_name); 594 599 595 600 if (-e $document_file_full) { 596 & util::cp($document_file_full, $documents_directory);601 &FileUtils::copyFiles($document_file_full, $documents_directory); 597 602 } 598 603 … … 606 611 # file local to metadata record 607 612 # => copy has been made successfully, so remove original 608 & util::rm($document_file_full);613 &FileUtils::removeFiles($document_file_full); 609 614 } 610 615 } -
main/trunk/greenstone2/bin/script/grab_collection.pl
r2671 r28560 1 1 #!/usr/bin/perl -w 2 2 3 use util; 3 4 4 5 # Both this script and its associated process_html.pl were written by … … 550 551 } 551 552 553 # the wget binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lions (android too?) 554 &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set 555 552 556 # wget is set to 'q - quiet' and 'nc - dont clobber existing files' 553 557 $kommand = $wget.' -qnc --directory-prefix='.$temp_outputdir.$image_dir.' "'.$found.'"'; -
main/trunk/greenstone2/bin/script/gsWget.pl
r2304 r28560 36 36 37 37 use util; 38 use FileUtils; 38 39 39 40 # wget should live in the Greenstone directory structure 40 41 # we'll bail if we can't find it 41 42 my $exe = &util::get_os_exe (); 42 my $cmd = & util::filename_cat($ENV{'GSDLHOME'}, "bin", $ENV{'GSDLOS'}, "wget");43 my $cmd = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "bin", $ENV{'GSDLOS'}, "wget"); 43 44 $cmd .= $exe; 44 45 if (! -e "$cmd") { … … 52 53 $cmd = "wget"; 53 54 } 55 56 # the wget binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lions (android too?) 57 &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set 54 58 55 59 # command-line parameters -
main/trunk/greenstone2/bin/script/importfrom.pl
r17198 r28560 40 40 use colcfg; 41 41 use util; 42 use FileUtils; 42 43 use parsargv; 43 44 use FileHandle; … … 62 63 print STDERR " -debug Print imported text to STDOUT\n"; 63 64 print STDERR " -collectdir directory Collection directory (defaults to " . 64 & util::filename_cat($ENV{'GSDLHOME'}, "collect") . ")\n";65 &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "collect") . ")\n"; 65 66 print STDERR " -out Filename or handle to print output status to.\n"; 66 67 print STDERR " The default is STDERR\n\n"; … … 96 97 { 97 98 my ($wget_cmd,$out,$verbosity) = @_; 99 100 # the wget binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lions (android too?) 101 &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set 98 102 99 103 if ($verbosity>2) { … … 210 214 print $out "Getting document $doc_url\n"; 211 215 212 & util::mk_dir($output_dir) if (!-e "$output_dir");213 214 my $full_id_fname = & util::filename_cat($output_dir,$id_fname);216 &FileUtils::makeDirectory($output_dir) if (!-e "$output_dir"); 217 218 my $full_id_fname = &FileUtils::filenameConcatenate($output_dir,$id_fname); 215 219 216 220 my $wget_cmd = "wget $wgetopt --quiet -O \"$full_id_fname\" \"$doc_url\""; 221 222 # the wget binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lions (android too?) 223 &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set 217 224 218 225 if (system($wget_cmd)!=0) { … … 245 252 my $i_os = $i; #convert OAI set separators (:) to OS dir sep 246 253 $i_os =~ s/:/$ds/g; 247 my $file_i = & util::filename_cat($output_dir,"$i_os.oai");254 my $file_i = &FileUtils::filenameConcatenate($output_dir,"$i_os.oai"); 248 255 249 256 # obtain record 250 257 my $wget_cmd = "wget $wgetopt -q -O - \"$url\""; 258 259 # the wget binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lions (android too?) 260 &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set 251 261 252 262 open (OAIIN,"$wget_cmd|") … … 267 277 my ($i_dir,$unused) = dir_file_split($file_i_url); 268 278 269 & util::mk_all_dir($i_dir);279 &FileUtils::makeAllDirectories($i_dir); 270 280 271 281 # look out for identifier tag in metadata section … … 286 296 ## $revised_doc_url =~ s/hdl\.handle\.net/mcgonagall.cs.waikato.ac.nz:8080\/dspace\/handle/; 287 297 288 my $srcdocs_dir = & util::filename_cat($i_dir,"srcdocs");298 my $srcdocs_dir = &FileUtils::filenameConcatenate($i_dir,"srcdocs"); 289 299 290 300 if (get_oai_document($revised_doc_url,$srcdocs_dir, $out)) { … … 360 370 # get acquire list 361 371 my $acquire = []; 362 $configfilename = & util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "etc", "collect.cfg");372 $configfilename = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, "etc", "collect.cfg"); 363 373 if (-e $configfilename) { 364 374 $collectcfg = &colcfg::read_collect_cfg ($configfilename); … … 383 393 # fill in the default import directory if none 384 394 # were supplied, turn all \ into / and remove trailing / 385 $importdir = & util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "import") if $importdir eq "";395 $importdir = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, "import") if $importdir eq ""; 386 396 $importdir =~ s/[\\\/]+/\//g; 387 397 $importdir =~ s/\/$//; … … 391 401 print $out "Warning - removing current contents of the import directory\n"; 392 402 print $out " in preparation for the acquire\n"; 393 & util::rm_r($importdir);403 &FileUtils::removeFilesRecursive($importdir); 394 404 } 395 405 -
main/trunk/greenstone2/bin/script/mirror.pl
r24362 r28560 84 84 85 85 # get the etc directory 86 $etcdir = & util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "etc");86 $etcdir = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, "etc"); 87 87 88 88 # check the collection configuration file for options 89 89 my $interval = 0; 90 $configfilename = & util::filename_cat($ENV{'GSDLCOLLECTDIR'},90 $configfilename = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, 91 91 "etc", "collect.cfg"); 92 92 if (-e $configfilename) { … … 107 107 # make sure there is an import directory 108 108 if (! -e "$importdir") { 109 & util::mk_dir($importdir);109 &FileUtils::makeDirectory($importdir); 110 110 } 111 111
Note:
See TracChangeset
for help on using the changeset viewer.