Crates.io | stowsave |
lib.rs | stowsave |
version | 0.1.7 |
source | src |
created_at | 2024-09-22 13:16:24.731303 |
updated_at | 2024-10-11 23:39:18.915004 |
description | Automates moving files into a stow directory then using stow to create symlinks back to where the files came from |
homepage | https://github.com/Jasha10/farmbot/tree/main/crates/stowsave |
repository | |
max_upload_size | |
id | 1382966 |
size | 47,376 |
stowsave
automates the process of moving files from their original location to a Stow package
directory then running GNU stow to create symlinks. Backups of the original files are created
to prevent data loss.
For example, say your working on ~/dev/project/my_script
. Invoking stowsave
as
stowsave ~/dev/project/my_script ~/my/stow/directory
will do the following:
~/dev/project/my_script
at ~/dev/project/my_script.bak
,~/dev/project/my_script
to ~/my/stow/directory/dev/project/my_script
, andstow
in ~/my/stow/directory
to create a symlink at ~/dev/project/my_script
pointing to ~/my/stow/directory/dev/project/my_script
.cargo install stowsave
stowsave <PATH_TO_SAVE> <STOW_PACKAGE>
<PATH_TO_SAVE>
: The path to the file or directory you want to save<STOW_PACKAGE>
: The directory where your Stow packages are storedWhat does the above do?
<PATH_TO_SAVE>
file or directory, backing up to
<PATH_TO_SAVE>.bak
. For directories, the backup is recursive is a recursive copy operation.<PATH_TO_SAVE>
to the given <STOW_PACKAGE>
.stow
to create symlinks from the <STOW_PACKAGE>
to the original location of
<PATH_TO_SAVE>
.stowsave ~/.vimrc ~/dotfiles/vim
This command will:
~/.vimrc
to ~/dotfiles/vim/.vimrc
~/.vimrc
to ~/.vimrc.bak
stow vim
in the ~/dotfiles
directorystowsave
operation:
- remove the symlink that points into the stow package. This could possibly be done by
running stow -D
on the stow package, but that would remove all symlinks into the
package so we'd have to run stow
again on the package later to restore the other
symlinks.
- move the original file out of the stow package and to the location where the symlink
was.
- remove empty directorie(s) within the stow package that contained the file that's
been moved.stowsave .config ~/dotfiles/pkg
might be unwanted if the .config
folder already contains some symlinks that point into the
This README file is generated based on the docs in src/main.rs
.