-
-
Save Forest-Dewberry/ab317bf6b683f0b85df99c8b52285fbe to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bashSCRIPT_IS_RUN_FROM=$(pwd) | |
PS_DEFAULT_DIR="$1" | |
PS_DEFAULT_DIR="$(wslpath -- "$PS_DEFAULT_DIR")" | |
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )"; # get the script dir | |
# Now loop through every file in MyFunctionsModules | |
# Each file should have a directory of the same name created in and be copied to that directory. | |
cd -- "$SCRIPT_DIR" | |
cd -- "$2" | |
FILESFROM=$(pwd) | |
for i in * | |
do | |
if test "$i" | |
then | |
filename=$(basename -- "$i") | |
extension="${filename##*.}" | |
filewoext="${filename%.*}" | |
cd -- "$SCRIPT_IS_RUN_FROM" # The PS_DEFAULT_DIR can be input relative to where the script was run from or an absolute path. | |
mkdir -- "$PS_DEFAULT_DIR/$filewoext" 2>/dev/null | |
cd -- "$FILESFROM" | |
cp -- "$filename" "$PS_DEFAULT_DIR/$filewoext/$filewoext.psm1" | |
cd "$FILESFROM" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment