isue with file-find and search/replace function

2011-02-28 Thread Conor Lillis
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

my $dir = 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



**
Private, Confidential and Privileged. This e-mail and any files and attachments 
transmitted with it are confidential and/or privileged. They are intended 
solely for the use of the intended recipient. The content of this e-mail and 
any file or attachment transmitted with it may have been changed or altered 
without the consent of the author. If you are not the intended recipient, 
please note that any review, dissemination, disclosure, alteration, printing, 
circulation or transmission of this e-mail and/or any file or attachment 
transmitted with it, is prohibited and may be unlawful. This e-mail and any 
files and attachments transmitted with it are unencrypted unless specifically 
advised otherwise. If you have received this e-mail or any file or attachment 
transmitted with it in error please notify Anglo Irish Bank Corporation 
Limited, Stephen Court, 18/21 St Stephen's Green, Dublin 2, Ireland, telephone 
no: +353-1-6162000. 
Directors: A.M. Dukes Chairman, A.M.R. Aynsley (Australian) Chief Executive, N. 
Cawley, A. Eames, M.A. Keane, P.G. Kennedy
Registered Office: Stephen Court, 18/21 St Stephen's Green, Dublin 2 Ireland
Registered in Ireland: No 22045
Anglo Irish Bank Corporation Limited is regulated by the Central Bank of 
Ireland. Anglo Irish Bank Corporation Limited (trading as Anglo Irish Bank 
Private Banking) is regulated by the Central Bank of Ireland. Anglo Irish 
Assurance Company Limited is regulated by the Central Bank of Ireland. 
**
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: isue with file-find and search/replace function

2011-02-28 Thread Brian Raven
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