directory listing to database

11 views
Skip to first unread message

fugee ohu

unread,
Oct 24, 2018, 10:42:31 AM10/24/18
to Ruby on Rails: Talk
I wanna copy directory listings from removable media to a database so then I'll know what files are on what removable disk I'm  thinking at the system level i have to list the directory to a file and then open the file for reading in ruby and then use the split function to parse each line as I iterate through Before I go ahead and do this is there another way?

Colin Law

unread,
Oct 24, 2018, 11:02:32 AM10/24/18
to rubyonra...@googlegroups.com
You could use one of the shell commands [1] which will give you back the directory listing direct to your code.  No need for an intermediate file.
However, if you google for
ruby directory listing
it will show you much better ways.  Usually google will be much quicker for asking such questions than here.

Colin

On Wed, 24 Oct 2018 at 15:42, fugee ohu <fuge...@gmail.com> wrote:
I wanna copy directory listings from removable media to a database so then I'll know what files are on what removable disk I'm  thinking at the system level i have to list the directory to a file and then open the file for reading in ruby and then use the split function to parse each line as I iterate through Before I go ahead and do this is there another way?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/667c62e3-d949-4710-ad30-8d4f9af5ac55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages