DEV Community

Discussion on: Basic Bash Automation: A script to organize my downloads folder

Collapse
 
moopet profile image
Ben Sinclair

This might be simpler as a function or a script held in your bin directory.

If you include the following in your bashrc or equivalent, you can drop scripts into ~/bin and the system will check there first.

if [ -d "$HOME/bin" ]; then
  export PATH="$HOME/bin:$PATH"
fi
Enter fullscreen mode Exit fullscreen mode

Then your organize.sh can move to ~/bin/organize and start with a cd ~/Downloads || exit line to make it work in the correct download directory. I often drop the .sh extension on common utility scripts myself, though it doesn't really matter as long as it has a shebang.

Collapse
 
w3ndo profile image
Patrick Wendo

Thank you. I did not know about this. Will add it to V2