in reply to Remove Script for a Infrastructure file managenet system running embedded perl

sanju7:

It looks like you're forgetting that the backslash character is an escape, so if you want *one* backslash, you need to put two in. So the line:

our $ThisSourceDirectory = "\\hostname\share-test\";

should be:

our $ThisSourceDirectory = "\\\\hostname\\share-test\\";

Or, since perl is perfectly happy with forward slashes instead of backslashes (even on Windows), you could use:

our $ThisSourceDirectory = "//hostname/share-test/";

...roboticus

I won't even comment on the use of our instead of my.

Replies are listed 'Best First'.
Re^2: Remove Script for a Infrastructure file managenet system running embedded perl
by sanju7 (Acolyte) on Jul 18, 2010 at 05:07 UTC

    Hi roboticus,

    Escaping the backslashes aren't exactly helpful. The error i get is,

    Can't stat \\hostname\share-test: No such file or directory at testArchive.pl line 30

    Can't stat \\hostname\share-test: No such file or directory at testArchive.pl line 42

    This is probably because the script is running from a different server node than the share directories it is trying to stat("\\hostname\share-test"). A test with remote windows shares reachable by "\\{nodename}" came out with this error. Perhaps rmdir is won't connect the share directory from a given path such a way. Thanks for the quick response though.

      sanju7:

      I find the first error message surprising, as I'd expect that the line numbers reported would be lines where the code would actually try to access the files, rather than for calling File::Find's find function. I notice that you've got a prototype on your filter function, so I'd drop the parenthesis. I don't know perl well enough to know if it would/could cause that problem or not, but it's certainly not helpful.

      ...roboticus

        Dropping the parenthesis doesn't change anything. I am still not getting if the script didn't understand the path belongs to a remote share and trying to stat it locally causing the error ..?