NAME

FSpot::DbTools::Paths

SYNOPSIS

use FSpot::DbTool;

my $fs = FSpot->new();
my $db_tool = $fs->db_tool();
$db_tool->load_tool( 'Paths' );

DESCRIPTION

Some useful methods for path manipulation

METHODS

replace_path( %params )

Replace one path with another in the database. Useful if you move all your photos to a new location and want to replace all the old paths

Usage:

$fs->replace_path( from   => $from_path,
                   to     => $to_path, );

move_dir( %params )

Move all files in a directory from one location to another, and make the changes in the database too.

Usage:

$fs->replace_path( from   => $from_path,
                   to     => $to_path,
                   rename => 1,
                   merge  => 1 );

rename and merge are optional, and default to 0

rename if enabled will cause files to be renamed by adding a counter to the end of the filename (before extension) in the target directory. e.g. if My_Picture.jpg is to be moved to a directory where My_Picture.jpg already exists, it will be renamed to My_Picture_1.jpg

merge if enabled it will allow files to be merged into an existing directory.

Changes are only made in the database (for each file) if the move for that file was successful.

find_lost_files( %params )

Find files which exist in the filesystem, but do not exist in the database Returns ArrayRef of lost files

Usage:

my $lost_files = $fs->lost_files( path => $path );

find_orphans( %params )

Find orphaned files (files which exist in in the database, but not on the filesystem) Returns HashRef of database entries for orphans

Usage:

my $orphans = $fs->find_orphans();

search_base_uri( %params )

Search for photos with a given base_uri.

wildcard is optional and defaults to 0 if not defined

Usage:

$fs->seacrh_base_uri(  path     => $path,
                       wildcard => 1 );

clean_trailing_slashes( %params )

Cleans the trailing slashes from paths

Usage:

$fs->clean_trailing_slashes();

AUTHOR

Robin Clarke perl@robinclarke.net