NAME FileMirror - class to help write file copying and moving scripts SYNOPSIS use FileMirror; # class methods $fm = FileMirror->new( '/tmp/sourcedir', '/tmp/destdir' ); # object data methods # get versions $fm->sourcedir; $fm->destdir; $fm->os; # what the class thinks the OS is # set versions $fm->sourcedir( '/tmp/sourcedir' ); $fm->destdir( '/tmp/destdir' ); # methods $fm->copy( '/tmp/sourcedir/filename' ); $fm->move( '/tmp/sourcedir/filename' ); $fm->delete_original( '/tmp/sourcedir/filename' ); $destination_path = $fm->dest_from_source( '/tmp/sourcedir/filename' ); # example my $fm = FileMirror->new( '/tmp/s', '/tmp/d' ); $fm->move( '/tmp/s/path/to/a.txt' ); # moves a.txt into /tmp/d/path/to DESCRIPTION FileMirror helps you write file copying scripts to move or copy files from one file hierarchy to another, while retaining the directory structure. It includes features to reduce the risk of data loss, by checking to see that the file appears to be copied over correctly, before deleting the original. File path manipulation is done within the class, saving you the effort of altering the paths yourself. To use the methods correctly, follow these two principles: * specify full paths to the source and destination; * specify full paths to the copy() and move() methods. Behavior for using relative paths is undefined at this time. For maximum saftey, you should not use chdir or relative paths. This is a good principle, even when you're not using this class. BUGS The behavior of using relative paths is undefined. They will probably work, relative to $CWD, but, if you do a chdir, it could all fall apart.