NAME
File::LinkDir - Create links in one directory for files in another
SYNOPSIS
use File::LinkDir;
my $linkdir = File::LinkDir->new( 'source' => '/path/to/dir', 'dest' => '/dest/path', 'hard' => 1, 'recursive' => 1 );
$linkdir->run();
$linkdir->init( 'source' => '/new/path', 'dest' => '/new/dest', );
$linkdir->run();
DESCRIPTION
By default, File::LinkDir will create symlinks in the destination directory for all top-level files, directories or symlinks found in the source directory. This is very useful for keeping the dot files in your $HOME
under version control. A typical use case:
use File::LinkDir;
my $linkdir = File::LinkDir->new( 'source' => '.', 'dest' => '~' );
$linkdir->run();
METHODS
new
Creates a new File::LinkDir object. This will call init() to set the options unless you pass 'skipinit' as the first argument.
init
Initializes the object according to the options that were passed. This is automatically called by new() but can be called if you want to reuse the object for other directories.
run
Creates the links based on the options that were used in new() and/or init().
OPTIONS
dryrun
dryrun => 1
Prints what would have been done without actually doing it.
source
source => DIR
The source directory.
dest
dest => DIR
The destination directory.
recursive
recursive => 1
With recursive => 1
, it will not create symlinks to subdirectories found in the source directory. It will instead recurse into them and create symlinks for any files or symlinks it finds. Any subdirectories not found in the destination directory will be created. This approach is useful for destination directories where programs or users other than yourself might add things to subdirectories which you don't want ending up in your working tree implicitly. /etc is a good example.
In both cases, symlinks from the source directory will be copied as-is. This makes sense because the symlinks might be relative.
ignore
ignore => RX
RX is a regex matching files to ignore. If ignore => 1
is not specified, it defaults to ignoring .git (plus .gitignore, .gitmodules, etc, but not .gitconfig) and .svn directories and their contents.
addignore
addignore => RX
Like ignore => RX
but doesn't replace the default.
force
force => 1
Remove and/or overwrite existing files/dirs.
hard
hard => 1
Creates hard links instead of symlinks.
AUTHOR
Hinrik Örn Sigurðsson, <hinrik.sig@gmail.com> Matthew Musgrove, <mr.muskrat@gmail.com>
BUGS
Please report any bugs or feature requests to bug-file-linkdir at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-LinkDir. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc File::LinkDir
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
COPYRIGHT
Copyright (c) 2009-2010 Hinrik Örn Sigurðsson and Matthew Musgrove
LICENSE
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.