Hi,

Thanks for the help. Below is the code and (although from memory) a listing of the /Volumes/ directory.

/Volumes/:

10 GB Firewire Drive
eDrive
PRINCETON;DELLSERVER
PRINCETON;DELLSERVER-1
PRINCETON;DELLSERVER-2
PRINCETON;DELLSERVER-3

And the perl code:
------------------------------------------------------------------------ -----
#!/usr/bin/perl -w


use strict;
use File::Copy;

my @dbname = ("file 1.dat","file 2.dat","file 3.dat","file 4.dat");
my @dbpath = ("directory 1","directory 2/subdirectory 2","SharedDocs","SharedDocs");
my $dirto = "/Volumes/10GB Firewire Drive/";
my $dirfrom = "/Volumes/PRICETON;DELLSERVER/";
my ($backup, $i);


my $timetest = time;

my ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime($timetest);
$year = substr(1900 + $year,2,2);
$mon++;
if ($mon  < 10) { $mon  = "0$mon";  }
if ($mday < 10) { $mday = "0$mday"; }
my $date = "$mon-$mday-$year";

for ($i=0; $i<=$#dbname; $i++) {
$backup = $dbname[$i]."-$date.bak";
copy ("$dirfrom$dbpath[$i]/$dbname[$i]", "$dirto$backup") or warn "Can't copy file $dirfrom$dbpath[$i]/$dbname[$i] to $dirto$backup - $!\n";
if (-e "$dirto$backup") {
print "$dbname[$i] backed up.\n";
} else {
print "$dbname[$i] NOT backed up!\n";
}
}


print "Backup Complete.\n";
------------------------------------------------------------------------ ----------------


I hope this makes things more clear.

Thanks,

Mark

On Apr 30, 2004, at 8:54 PM, Chris Devers wrote:

On Fri, 30 Apr 2004, Mark Wheeler wrote:

[snip] In the Volumes directory, it lists the following as the mounted
folder:

PRINCETON;DELLSERVER

How do I get into the server? The pathway I tried is:

/Volumes/PRINCETON;DELLSERVER/........

That didn't work.

These kinds of things are *always* easier for people to debug when we can actually see, at a minimum, a sample of the code in question. In this case, seeing a directory listing wouldn't hurt either:

   $ ls -l /Volumes/

At a guess, the semi-colon may need to be escaped with a backslash.
These shell commands try to show why:

$ ls -l PR*
ls: PR*: No such file or directory
$ touch PRINCETON;DELLSERVER
bash: DELLSERVER: command not found
$ ls -l PR*
-rw-r--r-- 1 cdevers admin 0 Apr 30 23:44 PRINCETON
$ touch PRINCETON\;DELLSERVER
$ ls -l PR*
-rw-r--r-- 1 cdevers admin 0 Apr 30 23:44 PRINCETON
-rw-r--r-- 1 cdevers admin 0 Apr 30 23:44 PRINCETON;DELLSERVER
$ rm PR*
$ touch 'PRINCETON;DELLSERVER'
$ ls -l PR*
-rw-r--r-- 1 cdevers admin 0 Apr 30 23:45 PRINCETON;DELLSERVER
$ rm PR*
$ touch "PRINCETON;DELLSERVER"
$ ls -l PR*
-rw-r--r-- 1 cdevers admin 0 Apr 30 23:46 PRINCETON;DELLSERVER
$ rm PR*
$ touch "PRINCETON\;DELLSERVER"
$ ls -l PR*
-rw-r--r-- 1 cdevers admin 0 Apr 30 23:46 PRINCETON\;DELLSERVER


See what's going on? With a backslash or quotes, I'm able to create the
file. With no backslash, I create a file with everything up until the
semi-colon as the name; with quotes and a backslash the file ends up
having the literal backslash character.

So, it's hard to say what you need to do without knowing what your code
looks like, but bear in mind that Perl's rules for this kind of thing
will be similar to what the shell is doing here. Just note that you
probably *must* quote the string, or Perl will treat the text as a
bareword and throw ugly warnings & errors at you, so you need some way
of balancing quotes & backslashes appropriately. Make sense?


It may be easier for you to just symlink the semi-colon version of the name to an easier equivalent:

    $ ln -s /Volumes/PRINCETON\;DELLSERVER /Volumes/dellserver

And things should be much easier in Perl-land after that...



--
Chris Devers




Reply via email to