From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Conor Lillis Sent: 28 February 2011 11:27 To: perl-win32-users@listserv.ActiveState.com Subject: isue with file-find and search/replace function
> HI all > I have an issue where I am trying to replicate a folder structure to another > server with a different root > folder structure. > Basically what I have is as follows: > Source dir = c:\temp > Dest dir = linux file system (so I need to strip the c:\temp from the SCP > command I am generating) > Here is the script use strict; use warnings; > my $dir = "c:\\temp"; Try "c:/temp" > chomp($dir); > print "The folder name is $dir\n\n"; > find(\&UploadStuff, $dir); > sub UploadStuff > { > my $file = $_; > my $currentdir = $File::Find::dir; > my $currentfile = $File::Find::name; > if (!-d $file) > { > my $scpfile = $file; > print "Current Dir before stripping path\t- $currentdir\n"; > $currentdir =~ s/$dir//i; > print "scpfile = $scpfile\nCurrent Dir after stripping path\t- > $currentdir\n"; > exit; > } > } > And output : > The folder name is c:\temp > Current Dir before stripping path - c:\temp/SMTPSVCLOG > scpfile = smtpsvc_20100228.log > Current Dir after stripping path - c:\temp/SMTPSVCLOG HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs