Forum: Ruby Rename file on windows share

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5521f919bded4d92aca70d47e86457f8?d=identicon&s=25 Emmanuel BOUGEROLLE (ebougerolle)
on 2017-01-03 13:17
Hi,

I'm trying to rename a file to another folder located on a windows share
folder.

I've got this message :

`rename': Permission denied @ rb_file_s_rename -
(T:/FLUX_PES/PESALR1EM01RE0120170103081859.xml,
T:/FLUX_PES/history/PESALR1EM01RE0120170103081859.xml) (Errno::EACCES)

Have you an idea ?

Thanks
B078cb4f4fb473c7a54d1fc36d10c70e?d=identicon&s=25 Regis d'Aubarede (raubarede)
on 2017-01-03 20:46
Emmanuel BOUGEROLLE wrote in post #1185417:
> Hi,
>
> I'm trying to rename a file to another folder located on a windows share
> folder.
>
> I've got this message :
>
> `rename': Permission denied @ rb_file_s_rename -
> (T:/FLUX_PES/PESALR1EM01RE0120170103081859.xml,
> T:/FLUX_PES/history/PESALR1EM01RE0120170103081859.xml) (Errno::EACCES)
>
> Have you an idea ?
>
> Thanks
File.rename work on sharef file system :
==
>cd _Affaires_à_ARCHIVER

T:\X>ls
traceArchivage.txt

T:\X>irb
irbrc: d:/usr/Ruby/local/irbrc.rb
History: d:\usr\Ruby\local/irb-history.txt => 31 KB
>> File.rename("traceArchivage.txt","traceArchivage2.txt")
=> 0
>> exit

T:\_Affaires_à_ARCHIVER>dir
 Le volume dans le lecteur T s’appelle DATA
 Le numéro de série du volume est 3A57-0713

 Répertoire de T:\_Affaires_à_ARCHIVER

03/01/2017  20:43    <DIR>          .
03/01/2017  20:43    <DIR>          ..
19/07/2011  08:30                64 traceArchivage2.txt
===

maybe your file is locked by another tool : word/excel, xml editor ...
5521f919bded4d92aca70d47e86457f8?d=identicon&s=25 Emmanuel BOUGEROLLE (ebougerolle)
on 2017-01-03 22:00
Hi,

You're right...

My XML file was open with Nokogiri and not in a block.

It's ok with closing file...

I had no problems in MacOS on local drive...

Thx,

(Merci pour la réponse.... j'ai fini par trouver en fin d'après-midi)
This topic is locked and can not be replied to.