# Other directories in Files Explorer App

**URL:** <https://discourse.openondemand.org/t/other-directories-in-files-explorer-app/335>\
**Category:** Get Help\
**Created:** [May 6, 2019, 5:04pm UTC](https://discourse.openondemand.org/t/other-directories-in-files-explorer-app/335 "2019-05-06T17:04:29Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcuma](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mcuma/32/171_2.png) [@mcuma](https://discourse.openondemand.org/u/mcuma)\
**Post date:** [May 6, 2019, 5:04pm UTC](https://discourse.openondemand.org/t/other-directories-in-files-explorer-app/335/1 "2019-05-06T17:04:29Z")

</div>

Hi everyone,

we have a request to show other file systems in the Files Explorer app. I am trying to follow [https://osc.github.io/ood-documentation/master/customization.html#add-shortcuts-to-files-menu](https://osc.github.io/ood-documentation/master/customization.html#add-shortcuts-to-files-menu) to add menu items for a few scratches but not having success.

I am starting with the following simple /etc/ood/config/apps/dashboard/initializers/ood.rb:  
OodFilesApp.candidate\_favorite\_paths.tap do |paths|  
paths \<\< Pathname.new("/scratch/serial/kingspeak/#{User.new.name}")  
end

So, want to add a new item called /scratch/serial/kingspeak/user\_name, but it does not look like it’s recognized since there’s no new item in the Files menu.

Can someone please add some information on the (presumed) Ruby User object so I get a better idea of what it contains, and, also, how to troubleshoot issues like this - e.g. where would the logs be (if any), etc.

Thanks,  
MC

---

<div class="post-metadata">

**Author:** ![efranz](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/efranz/32/27_2.png) [@efranz](https://discourse.openondemand.org/u/efranz)\
**Post date:** [May 6, 2019, 5:25pm UTC](https://discourse.openondemand.org/t/other-directories-in-files-explorer-app/335/2 "2019-05-06T17:25:01Z")

</div>

The link in the Files menu will not appear unless the directory actually exists. Can you confirm that /scratch/serial/kingspeak/your\_username actually exists and you have rx to it?

---

<div class="post-metadata">

**Author:** ![azric](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/azric/32/63_2.png) [@azric](https://discourse.openondemand.org/u/azric)\
**Post date:** [May 6, 2019, 5:44pm UTC](https://discourse.openondemand.org/t/other-directories-in-files-explorer-app/335/3 "2019-05-06T17:44:12Z")

</div>

Here’s what we use for scratch space

# UA ood.rb initializer.

![](https://us1.discourse-cdn.com/flex015/uploads/osc/original/1X/54c580f4e983c4f3324813299ea8bd276a059acb.png)

![](https://us1.discourse-cdn.com/flex015/uploads/osc/original/1X/c77c2ac9082691ea7b08cd12b20a0c072cbd1946.png)

---

<div class="post-metadata">

**Author:** ![mcuma](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mcuma/32/171_2.png) [@mcuma](https://discourse.openondemand.org/u/mcuma)\
**Post date:** [May 6, 2019, 5:47pm UTC](https://discourse.openondemand.org/t/other-directories-in-files-explorer-app/335/4 "2019-05-06T17:47:35Z")

</div>

Hi Eric,

yes, the directory does exist - though I had a typo in the definition. Thanks for the reminder to check it. Now it works, great. It’s also good that the menu item does not show if the directory does not exist.

I have a follow up question.

Some of our users also have “group” space, which has somewhat different name pattern, /uufs/chpc.utah.edu/common/home/PI\_group#, where PI is the group name, # is a number, which can range from 0 to group\_max=18 currently.

What would be the best way to get all these? I figure we can start with the User.new.groups and create the basic path as “/uufs/chpc.utah.edu/common/home/#{p}\_group”, (#{p} is the group name) but given that most groups # number range is small (0-2), I don’t think hard putting the range 0-18 would be very efficient so we’d probably want to instead get output of something like “ls /uufs/chpc.utah.edu/common/home/group\_name\*” and feed that to the OOD paths list.

What would be your thoughts on that?

To illustrate the situation better, I am pasting an output of ls for a first page of the group dirs we have:  
$ ls -1 -d /uufs/chpc.utah.edu/common/home/_-group_ |more  
/uufs/chpc.utah.edu/common/home/anderegg-group1  
/uufs/chpc.utah.edu/common/home/anderegg-group2  
/uufs/chpc.utah.edu/common/home/armentrout-group1  
/uufs/chpc.utah.edu/common/home/avey-group3  
/uufs/chpc.utah.edu/common/home/balagurunathan-group1  
/uufs/chpc.utah.edu/common/home/bmi-group1  
/uufs/chpc.utah.edu/common/home/bolton-group1  
/uufs/chpc.utah.edu/common/home/bowen-group2  
/uufs/chpc.utah.edu/common/home/calaf-group1  
/uufs/chpc.utah.edu/common/home/camp-group1  
/uufs/chpc.utah.edu/common/home/camp-group2  
/uufs/chpc.utah.edu/common/home/cao-group1  
/uufs/chpc.utah.edu/common/home/cheatham-group1  
/uufs/chpc.utah.edu/common/home/cheatham-group2  
/uufs/chpc.utah.edu/common/home/cheatham-group4  
/uufs/chpc.utah.edu/common/home/cheatham-group5  
/uufs/chpc.utah.edu/common/home/cheatham-group6  
/uufs/chpc.utah.edu/common/home/cheatham-group7  
/uufs/chpc.utah.edu/common/home/chpc-group1  
/uufs/chpc.utah.edu/common/home/civil-group1  
/uufs/chpc.utah.edu/common/home/cliu-group4  
/uufs/chpc.utah.edu/common/home/codding-group1  
/uufs/chpc.utah.edu/common/home/conway-group1  
/uufs/chpc.utah.edu/common/home/conway-group2  
/uufs/chpc.utah.edu/common/home/coonh-group1  
/uufs/chpc.utah.edu/common/home/coopers-group1  
/uufs/chpc.utah.edu/common/home/cryoem-group1

Thanks,  
MC

---

<div class="post-metadata">

**Author:** ![azric](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/azric/32/63_2.png) [@azric](https://discourse.openondemand.org/u/azric)\
**Post date:** [May 6, 2019, 6:05pm UTC](https://discourse.openondemand.org/t/other-directories-in-files-explorer-app/335/5 "2019-05-06T18:05:22Z")

</div>

Hey Martin:  
We add the research group parent directory (/rsgrps here) to the menu, and let the users navigate from there, file/directory settings permitting. This was drive by the fact that a given user can be part of multiple research groups (e.g. /rsgrps/bill and /rsgrps/fred),  
and mind reading would be required to know which one was right for “today”.

Ric

---

<div class="post-metadata">

**Author:** ![mcuma](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mcuma/32/171_2.png) [@mcuma](https://discourse.openondemand.org/u/mcuma)\
**Post date:** [May 6, 2019, 8:07pm UTC](https://discourse.openondemand.org/t/other-directories-in-files-explorer-app/335/6 "2019-05-06T20:07:09Z")

</div>

Hi Ric,

do you have a settings file or a piece of code for this? My Ruby knowledge is close to zero so an example speaks thousand words.

Thanks,  
MC

---

<div class="post-metadata">

**Author:** ![azric](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/azric/32/63_2.png) [@azric](https://discourse.openondemand.org/u/azric)\
**Post date:** [May 6, 2019, 8:22pm UTC](https://discourse.openondemand.org/t/other-directories-in-files-explorer-app/335/7 "2019-05-06T20:22:53Z")

</div>

Here’s our setup for 2 directories beyond /home: /extra/UserID and /rsgrps

```auto
$ cat /etc/ood/config/apps/dashboard/initializers/ood.rb
# UA ood.rb initializer.
#
OodFilesApp.candidate_favorite_paths.tap do |paths|
  # add /extra directory
  paths << Pathname.new("/extra/#{User.new.name}")
  # add /rsgrps directory
  paths << Pathname.new("/rsgrps/")
end

```

---

<div class="post-metadata">

**Author:** ![efranz](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/efranz/32/27_2.png) [@efranz](https://discourse.openondemand.org/u/efranz)\
**Post date:** [May 6, 2019, 8:28pm UTC](https://discourse.openondemand.org/t/other-directories-in-files-explorer-app/335/8 "2019-05-06T20:28:07Z")

</div>

My guess is Ric’s example applied to your situation would be:

```ruby
OodFilesApp.candidate_favorite_paths.tap do |paths|
paths << Pathname.new("/scratch/serial/kingspeak/#{User.new.name}")
paths << Pathname.new("/uufs/chpc.utah.edu/common/home")
end

```

And then you navigate to the group directory you want.

Otherwise you could try this:

```ruby
OodFilesApp.candidate_favorite_paths.tap do |paths|

  # add scratch
  paths << Pathname.new("/scratch/serial/kingspeak/#{User.new.name}")

  # add project directories
  project = camp
  paths.concat Pathname.glob("/uufs/chpc.utah.edu/common/home/#{project}-group*")

end

```

of course you would replace `project = camp` with something like `project = OodSupport::User.new.group.name` or if you had multiple groups you would do

```ruby
  User.new.groups.each do |group|
    paths.concat Pathname.glob("/uufs/chpc.utah.edu/common/home/#{group.name}-group*")
  end

```

Note both of those rely on the getgrgid to turn a group id into a name String, so whatever provides the group database on the web node would need to be up to date: (/etc/group) - at least converting the id to the name, not necessarily the membership list of a group though.

Also, this approach means that if the project directory does not exist at application start up, the link will not appear in the user’s dashboard once the directory is created unless their per user web server is restarted.

---

<div class="post-metadata">

**Author:** ![mcuma](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mcuma/32/171_2.png) [@mcuma](https://discourse.openondemand.org/u/mcuma)\
**Post date:** [May 6, 2019, 9:09pm UTC](https://discourse.openondemand.org/t/other-directories-in-files-explorer-app/335/9 "2019-05-06T21:09:08Z")

</div>

Thanks guys,

I figured as much as hard coding the parent path 😉

But, Eric’s last suggestion is perfect, it works great.

It looks like Ruby is quite powerful as long as you know it, like C++. For those of us who don’t, and don’t want to waste Eric’s time - how about sticking a few more examples like this in the OOD User’s Guide?

Or, link to implementations on other sites. E.g. I am working on a document to share with our Rocky Mountain group where I am putting the local trickery, [https://github.com/CHPC-UofU/OnDemand-info](https://github.com/CHPC-UofU/OnDemand-info).

Thanks,  
MC

---

<div class="post-metadata">

**Author:** ![efranz](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/efranz/32/27_2.png) [@efranz](https://discourse.openondemand.org/u/efranz)\
**Post date:** [May 7, 2019, 1:30pm UTC](https://discourse.openondemand.org/t/other-directories-in-files-explorer-app/335/10 "2019-05-07T13:30:09Z")

</div>

I added an issue to update the documentation as suggested: [https://github.com/OSC/ood-documentation/issues/158](https://github.com/OSC/ood-documentation/issues/158)

Thank you for sharing the notes on Open Ondemand at CHPC!

---

<div class="post-metadata">

**Author:** ![westburg.2](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@westburg.2](https://discourse.openondemand.org/u/westburg.2)\
**Post date:** [May 26, 2022, 3:18pm UTC](https://discourse.openondemand.org/t/other-directories-in-files-explorer-app/335/11 "2022-05-26T15:18:28Z")

</div>

Closed on May 26, 2022, 3:18pm UTC


