0

I have a directory structure let's say of

/user/me/project1
/usr/me/project1/private/stuff
/usr/me/project1/whatever/bla/bla
/usr/me/project1/pdf/bla.pdf
/user/me/project2
/user/me/project2/priv1
/usr/me/project2/priv2
/usr/me/project2/pdf/sdfasfa.pdf

Anyway say I want to load a webserver with ROOT at /user/me But when I load the page at http://localhost I want to just see a "list" of all the .pdf files right there. Ideally I don't even want to show any "subdirectories" I want them "ignored"/hidden. Basically I would like to see all the pdf files in one list.

I'm ok with any method of rewrites etc and I would PREFER using nginx but I'm ok with other recommendations except for apache but anything that can run easily .jar or compile easily with gcc like nginx is fine. Oh and I don't want to change anything on the filesystem itself because those pdf files get updated so I want a simple way to share them all in one list easily without having to click through a bunch of subdirectories to get to them.

If it can't be done, the next best thing would be a way to "hide" certain directories or have a hide all "except" so that I can say "show" only /pdf/ dirs.

Xavier Lucas
  • 12,815
  • 2
  • 44
  • 50
htfree
  • 463
  • 4
  • 9
  • 21
  • I would approach this by making a script that makes symlinks to all those files to the directory where you want the files to be visible. Then you could use something like lsyncd to monitor the directories and automatically generate symlinks whenever new files appear or existing files change. – Tero Kilkanen Mar 29 '15 at 11:06
  • yea you're probably right, seems nginx and others might lack flexibility to achieve without, I did think about lsyncd and symlinks but was hoping to avoid since knew about lsyncd but hadn't really used it before. Also didn't know if lsyncd can watch 'just' certain directory etc I didn't want some fsevent etc running on entire file system when only need on one dir and subdirs. – htfree Mar 29 '15 at 19:10
  • Tero, if you put your reply as an 'answer' i'll accept it since I think you deserve the points for trying and seems its the best/only way to go. – htfree Mar 29 '15 at 20:27

1 Answers1

1

I would approach this by making a script that makes symlinks to all those files to the directory where you want the files to be visible. Then you could use something like lsyncd to monitor the directories and automatically generate symlinks whenever new files appear or existing files change.

Tero Kilkanen
  • 34,499
  • 3
  • 38
  • 58
  • strange, I don't see a way to accept your answer on here, it won't even let me upvote it. am I missing something? By the way I made a script and ran it with nginx and lua module as per http://stackoverflow.com/questions/22891148/nginx-how-to-run-a-shell-script-on-every-request , now I need to see how to show listing of page automatically after script runs, like maybe a redirect/forward or something. – htfree Mar 30 '15 at 00:07
  • I solved that part also, I used ngx_redirect and after running the system bash script through lua execute system call I then did the ngx redirect and am good to go. So the script runs each time the web page is loaded and creates any necessary symlinks and serves them to browser. – htfree Apr 13 '15 at 21:11