- Timestamp:
- 2012-05-09T14:33:01+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/util.pm
r25533 r25554 179 179 } 180 180 181 # Move the contents of source directory into target directory 182 # (as opposed to merely replacing target dir with the src dir) 183 # This can overwrite any files with duplicate names in the target 184 # but other files and folders in the target will continue to exist 185 sub mv_dir_contents { 186 my ($src_dir, $dest_dir) = @_; 187 188 # Obtain listing of all files within src_dir 189 # Note that readdir lists relative paths, as well as . and .. 190 opendir(DIR, "$src_dir"); 191 my @files= readdir(DIR); 192 close(DIR); 193 194 # construct absolute paths 195 foreach my $file (@files) { 196 # process all except . and .. 197 unless($file eq "." || $file eq "..") { 198 $file = &util::filename_cat($src_dir, $file); # this is sufficient to overwrite this file's name in @files 199 # don't seem to need a separate array to keep the updated absolute path versions of the filenames 200 } 201 } 202 &util::mv(@files, $dest_dir); 203 } 204 181 205 182 206 # copies a file or a group of files
Note:
See TracChangeset
for help on using the changeset viewer.