Kevin Old said:

> Hello everyone,
>
> I'm using the Filesys-SmbClient-1.4 to connect to a NT server via
> Samba.  With the code below, I am able to read & write the file without
> any problems.  The problem comes when I want to delete the file after
> I'm done with it.  All of this code was taken from the man page, so it
> should work.  The error message I get is:
>
> Can't unlink file:Device or resource busy
>
> Here's the code:
>
> #!/usr/bin/perl
>
>   use POSIX;
>   use Filesys::SmbClient;
>
> $myfile = "Ivrweb.csv";
>
>   open(FH, ">$myfile");
>   my $smb = new Filesys::SmbClient(username  => "kdo",
>                                    password  => "", #no password for
> security reasons
>                                    debug     => 0);
>
>   # Read a file
>   my $fd = $smb->open("smb://NTFS1/temp/web/$myfile", '0666');
>   while (defined(my $l= $smb->read($fd,50))) {print FH $l; }
>   $smb->close(fd);
>
> close(FH);
>
>
>   # Delete the file
>   $smb->unlink("smb://NTFS1/temp/web/$myfile")
>     or print "Can't unlink file:", $!, "\n";
>
>
> Any ideas what could be causing this?
>
> The "$smb->close(fd);" call is closing the file connection correct?

Incorrect.

And if you turn on warnings you will find out why.

[ $fd ]

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to