开发者

Listing files from the network in Rails

开发者 https://www.devze.com 2023-03-30 22:15 出处:网络
I\'d like to be able to list files from a distant directory开发者_开发百科 on the network with Rails (for instance, listing every pictures in a folder to move them and do some processing on them).

I'd like to be able to list files from a distant directory开发者_开发百科 on the network with Rails (for instance, listing every pictures in a folder to move them and do some processing on them).

So I tried to first list them by doing :

<% @files = Dir.glob("\\my\directory\on\the network\*" ) %>
<% @files.each do |file| %>
    <%= file %>
<% end %>

But I have no output, nothing, not even an error message or something. If anyone have a clue...

Thanks !


Try it like this:

<%- @files = Dir.entries("//my/directory/on/the/network") %>
<%- @files.each do |file| %>
    <%= file %>
<% end %>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号