in reply to Re: Re: Re: File::Copy dying on Win2k when target file already there
in thread File::Copy dying on Win2k when target file already there
John,
I did as you suggested and it works well. The readdir/while loop in the code above now looks like this:
The only caveat being that I had to chmod the files to 444 (readonly by everyone, including the owner (root in this case)). It is fine for Windows, but an annoyance on unix. I would have preferred 644 (writeable by the owner), but on Windows, that is the same as world writeable (from Perl's chmod perspective).opendir PLUGINS, "conf/plugins" or die "unable to opendir ./conf/plugi +ns\n"; while (my $pluginfile = readdir(PLUGINS) ) { my $localfile = Bio::Root::IO->catfile('conf/plugins',$pluginfile) +; if (-f $localfile) { my $installfile = Bio::Root::IO->catfile($plugindir, $pluginfi +le); chmod (0666, $installfile); copy($localfile, $installfile) or die "$localfile unable to copy to $installfile : $!\n"; chmod (0444, $installfile); } } closedir PLUGINS;
(I hate having to type :w and then :w! when I am reminded once again that the file is readonly.)
Thanks,
Scott
Project coordinator of the Generic Model Organism Database Project
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Re: Re: File::Copy dying on Win2k when target file already there
by John M. Dlugosz (Monsignor) on Jan 17, 2003 at 16:48 UTC | |
Re: Re: Re: Re: Re: File::Copy dying on Win2k when target file already there
by Aristotle (Chancellor) on Jan 18, 2003 at 15:33 UTC |
In Section
Seekers of Perl Wisdom