Search code examples
cubuntunautilus

Opening a folder locating a specific file in Ubuntu Nautilus Browser


My requirement is simple, I hope some intelligent geeks can help me here out.

I am working on a project[LINUX-UBUNTU], I have a c program, in which I have a char array having a path to a file, an want to open that folder in Ubuntu nautilus browser, also I want that file to get selected automatically possible.

Any help or guidance will be great.

--

Thanks

Alok Kr.


Solution

  • You can use popen (or any from its family) to call nautilus. On one hand, if the argument is a directory, then nautilus will open a window with that directory. On the other hand, if the argument is a file, then nautilus will open a window in that directory with that file selected.