Net::UploadMirror - Perl extension for mirroring a local directory via FTP to the remote location


  use Net::UploadMirror;
  my $um = Net::UploadMirror->new(
        ftpserver               => '',
        user            => 'my_ftp_user_name',
        pass            => 'my_ftp_password',
 or more detailed:

 my $md = Net::UploadMirror->new(
        ftpserver               => '',
        user            => 'my_ftp_user_name',
        pass            => 'my_ftp_password',
        localdir                => 'home/nameA/homepageA',
        remotedir       => 'public',
        debug           => 1 # 1 for yes, 0 for no
        timeout         => 60 # default 30
        delete          => 'enable' # default 'disabled'
        connection      => $ftp_object, # default undef
# "exclusions" default empty arrayreferences [ ]
        exclusions      => ["private.txt", "Thumbs.db", ".sys", ".log"],
# "subset" default empty arrayreferences [ ]
        subset          => [".txt, ".pl", ".html", "htm", ".gif", ".jpg", ".css", ".js", ".png"]
# or substrings in pathnames
#       exclusions      => ["psw", "forbidden_code"]
#       subset          => ["name", "my_files"]
# or you can use regular expressions
#       exclusinos      => [qr/SYSTEM/i, $regex]
#       subset          => {qr/(?i:HOME)(?i:PAGE)?/, $regex]
        filename        => "modified_times"


This module is for mirroring a local directory to a remote location via FTP. For example websites, documentations or developmentstuff which ones were worked on locally. Remote files on the ftp-server will be overwritten, also in case they are newer. It is not developt for mirroring large archivs. But there are not in principle any limits.

Constructor and Initialization =item (object) new (options) Net::UploadMirror is a derived class from Net::MirrorDir. For detailed information about constructor or options read the documentation of Net::MirrorDir.


(1) _Init (%arg) This function is called by the constructor. You do not need to call this function by yourself.
(1|0) Upload (void) Call this function for mirroring automatically, recommended!!!
(ref_hash_modified_files) CheckIfModified (ref_array_local_files) Takes a hashreference of local filenames to compare the last modification time, which is stored in a file, named by the attribute "filename", while uploading. Returns a reference of a list.
(1) UpdateLastModified (ref_array_local_files) Update the stored modified-times of the local files.
(1|0) StoreFiles (ref_array_paths) Takes a arrayreference of local-paths to upload the files via FTP.
(1|0) MakeDirs (ref_array_paths) Takes a arrayreference of directories to make in the remote location.
(1|0) DeleteFiles (ref_array_paths) Takes a arrayreference of files to delete in the remote location.
(1|0) RemoveDirs (ref_array_paths) Takes a arrayreference of directories to remove in the remote location.
(1) CleanUp (ref_array_paths) Takes a arrayreference of directories to compare with the keys in the {_last_modified} hash. Is the key not in the array or the value in the hash is incorrect, the key will be deleted.
(ref_array_local_paths) RtoL (ref_array_remote_paths) Takes a arrayreference of Remotepathnames and returns a arrayreference of the corresponding Localpathnames.
(ref_array_remote_paths) LtoR (ref_array_local_paths) Takes a arrayreference of Localpathnames and returns a arrayreference of the corresponding Remotepathnames.

optional options

filename The name of the file in which the last modified times will be stored. default = 'lastmodified_local'
delete When directories or files are to be deleted = 'enable' default = 'disabled'


None by default.




 Net::MirrorDir 0.19


 Maybe you'll find some. Let me know.


 When reporting bugs/problems please include as much information as possible.


 Torsten Knorr, E<lt>create-soft@tiscali.deE<gt>


 Copyright (C) 2005 - 2008 by Torsten Knorr

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.9.2 or, at your option, any later version of Perl 5 you may have available.

4 POD Errors

The following errors were encountered while parsing the POD:

Around line 324:

'=item' outside of any '=over'

Around line 364:

You forgot a '=back' before '=head2'

Around line 366:

'=item' outside of any '=over'

Around line 374:

You forgot a '=back' before '=head2'