in my application, I want to offer file downloads on a per-user basis.
That means, a user has to authenticate and gets assigned a user_id.
Now, in my filesystem, I have a directory for each user_id (above
webroot, of course) which contains subdirectories and files. What I
want to do is offer the files under each user's directory for
download. These files are uploaded or updated at random intervals with
rsync from another server. I have figured out how to secure the
download part with Apache and xsendfile, and it works fine.
But, what I need help with is, whenever there have been uploaded new
files, I want to have a rake task that scans the directories for all
the users and writes each file with it's path into a db table. I also
would like to get access to all the dir names and filenames found, so
I can split them up and use them as keys etc.
I searched the Rails groups but haven't really found any pointers how
this could be done.
Thanks for any help you can give me.