On 3/23/07, Richard Luckhurst <[EMAIL PROTECTED]> wrote:
snip
y> Check that the full file path is valid on the Windows system.
y> In general, Unix uses / and Windows uses \. Under eg cygwin I think it uses
y> /, but check the path works right.

I am aware of the path differences and I had tried the slashes both ways and it
makes no difference to my results.
snip

Note that to get a \ you need to use a \\ like this

$mv_result = `mv $dir\\pdfs\\$print_dir\\$book_no.PDF
$dir\\pdfs\\$print_dir\\$replace.PDF`;

You may also need to make sure you are in the correct directory with
chdir since you are using relative path names rather than absolute.
Of course, it looks like you are trying to rename the file, why not
just use the rename function in Perl:

my $path = "$dir/pdfs/$print_dir";
my $result = rename "$path/$book_no.PDF", "$path/$replace.PDF";

      rename OLDNAME,NEWNAME
              Changes the name of a file; an existing file NEWNAME will be
              clobbered.  Returns true for success, false otherwise.

              Behavior of this function varies wildly depending on your sys‐
              tem implementation.  For example, it will usually not work
              across file system boundaries, even though the system mv com‐
              mand sometimes compensates for this.  Other restrictions
              include whether it works on directories, open files, or pre-
              existing files.  Check perlport and either the rename(2) man‐
              page or equivalent system documentation for details.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to