Created
September 7, 2018 00:49
-
-
Save johnnydecimal/cab3a02bce70dab7a4567d460d5c36e2 to your computer and use it in GitHub Desktop.
Bash function to jump to any Johnny.Decimal folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://johnnydecimal.com | |
cjdfunction() { | |
pushd ~/Dropbox/*/*/${1}* # ~/Dropbox is my root folder, change to suit yours. | |
} | |
export cjdfunction | |
alias cjd='cjdfunction' # Or any other alias you prefer. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! I know it's I little late, but I just found out the answer on Reddit . This does the trick:
Where
~
is your Windows User folder (you should change this to reflec your actual Johnny.Decimal root folder), and\*\*\
is used to tell PowerShell that it should go two directories deep to find the folder with the numbers you just typed in (32.01
, for example). The last*
after$SearchString
is indicating the computer to look for32.01whatever
, since there shouldn't be two folders with the same code. Please remember to add that last*
, because the OP in Reddit forgot to add it in the final answer. This problem came up a little deeper into that thread and he never updated his main post, but kudos to them for figuring this one out.EDIT: If this is your first time dealing with PS scripts, please remember that you'll need to put the script in a very specific folder. Open PowerShell and type
cd $env:PSModulePath
to see where your Modules folders are. You can pick whichever you prefer, but I like the one that's in my home folder~\Documents\WindowsPowerShell\Modules
. Inside this folder, you should create one called "cdj", and inside that you'll make yourcdj.psm1
file, with the code I pasted above. Finally, you'll have to enable the execution of PS scripts with this simple command:set-executionpolicy unrestricted -force
(please keep in mind that this a global change, so be really careful with what you download and execute in the PowerShell. More on Execution Policies here).