#!/usr/bin/perl use strict; use warnings; use File::Copy qw(copy); use File::Mirror qw(mirror); use Try::Tiny; local $\ = "\n"; if (-e "J:/") { while () { my ($source,$destination) = split(/\|/,$_); chomp($source,$destination); print "Copying $source to $destination"; # I guess at one time the copy failed and made the script die, so I added # Tiny::Try to keep the script from dying. try { if (-f $source) { copy($source,$destination); } elsif (-d $source) { mirror($source,$destination); } else { print "What did you do wrong?"; } } catch { print "Couldn't copy $source to $destination"; } } } else { print "Insert the thumb drive!"; } __DATA__ C:/Documents and Settings/me/My Documents/home/checkbook2.xls|J:/My Documents/home/checkbook2.xls C:/Documents and Settings/me/Local Settings/Application Data/Microsoft/Outlook/Outlook.pst|J:/application data/Outlook/Outlook.pst C:/Documents and Settings/me/My Documents/gaming|J:/My Documents/gaming C:/Documents and Settings/me/My Documents/fantasy|J:/My Documents/fantasy C:/Documents and Settings/me/Application Data/Notepad++/stylers.xml|J:/application data/Notepad++/stylers.xml C:/Documents and Settings/me/Application Data/HexChat|J:/application data/HexChat