Changeset 25598 for main/trunk/greenstone2/perllib/util.pm
- Timestamp:
- 2012-05-14T18:45:15+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/util.pm
r25579 r25598 174 174 print STDERR "util::mv $file does not exist\n"; 175 175 } else { 176 rename ($file, $tempdest); 176 if(!rename ($file, $tempdest)) { 177 print STDERR "**** Failed to rename $file to $tempdest\n"; 178 &File::Copy::copy($file, $tempdest); 179 &rm($file); 180 } 181 elsif(-e $file) { # rename (partially) succeeded) but srcfile still exists after rename 182 #print STDERR "*** srcfile $file still exists after rename to $tempdest\n"; 183 if(!-e $tempdest) { 184 print STDERR "@@@@ ERROR: $tempdest does not exist\n"; 185 } 186 # Sometimes the rename operation fails (as does File::Copy::move). 187 # This turns out to be because the files are hardlinked. 188 # Need to do a copy-delete in this case, however, the copy step is not necessary: 189 # the srcfile got renamed into tempdest, but srcfile itself still exists, delete it. 190 #&File::Copy::copy($file, $tempdest); 191 192 &rm($file); 193 } 177 194 } 178 195 } … … 215 232 } 216 233 } else { # error 217 print STDERR "ERROR. util::mv_dir_contents: subfolder $file still non-empty after moving contents to $dest_ dir\n";234 print STDERR "ERROR. util::mv_dir_contents: subfolder $file still non-empty after moving contents to $dest_subdir\n"; 218 235 } 219 236 } else { # process files and any directories that don't already exist with a simple move … … 226 243 &mk_dir($dest_dir); 227 244 } 228 229 #print STDERR "@@@@@ Copying files to: $dest_dir\n"; 245 246 #print STDERR "@@@@@ Copying files |".join(",", @full_path_files)."| to: $dest_dir\n"; 247 230 248 if(@full_path_files) { # if non-empty, there's something to copy across 231 249 &mv(@full_path_files, $dest_dir);
Note:
See TracChangeset
for help on using the changeset viewer.