1

Elementary OS's file manager opens the last working directory whenever we launch that file manager.

How can I write a script for Nautilus which will work same as given example above?

pomsky
  • 70,557

1 Answers1

1

Nautilus does not keep trace of the last opened folder
But, it keeps trace of recent open files. See Recent section in Nautilus

The following 'Ask' gives a good answer : close Nautilus while saving Tabs state
A bit tricky but works: How can I make Nautilus file manager remember my open tabs?

This script opens Nautilus on the folder of the last opened file
This can be called by a custom launcher nautilus-last-file.desktop

#!/bin/bash
LastFolder=$(grep -m1 'bookmark href' '~/.local/share/recently-used.xbel' | cut -f2 -d"\"" | cut -c 8-)
LastFolder=$(printf '%b' "${LastFolder//%/\\x}")
LastFolder=$(dirname "$LastFolder")
/usr/bin/nautilus "$LastFolder"
cmak.fr
  • 8,976