GNU Stow: How to stow only selected files/folders?

stow has ignore lists which let you put a file called .stow-local-ignore at the top of your source tree. In that, you could put \.scripts to have stow ignore that directory and not link it into the target tree.


Let's introduce some Stow terminology:

By default Stow takes the current directory is your stow directory, the name you type as the argument in the command line as the stow package and the parent dir as the target directory, so when you type:

$ stow scripts

Without any option your stow directory is the current directory, scripts is your package and the parent of current directory becomes the stow target directory where the package will appear to be installed(where the symlinks will be created).

You can explicitly inform the stow directory and the package you want to install in the command line like in the following command:

$ stow -d /path_to_scripts_folder/scripts -S .scripts

Where the scripts here is defined as your stow directory and .scripts as your package in Stow terminology.

Optionally you can specify the target directory, that is the directory relative to where your files(symlinks to your files) should be placed:

$ stow -d /path/scripts -S .scripts -t ~/

To test any of this options you can use the -n flag that just simulate the changes without modify your file system:

$ stow -n -d /path/scripts -S .scripts -t ~/

And if you want to see all actions that should be taken you can add the -v specifying a verbosity level from 0(no -v flag) up to 3(-vvv):

$ stow -n -d /path/scripts -S .scripts -t ~/ -vvv 

As this options become more and more complex it could be better to write a little shell script to automate your work and give you maximum of flexibility.

Tags:

Stow