| # Define the source (folder a) and destination (folder b) | # Define the source (folder a) and destination (folder b) | ||||
| folder_a="$1" | folder_a="$1" | ||||
| folder_b="$2" | folder_b="$2" | ||||
| prefix="$3" | |||||
| # Ensure both folders exist | # Ensure both folders exist | ||||
| if [[ ! -d "$folder_a" ]]; then | if [[ ! -d "$folder_a" ]]; then | ||||
| # Check if the file already exists in folder_b | # Check if the file already exists in folder_b | ||||
| if [[ ! -e "$destination" ]]; then | if [[ ! -e "$destination" ]]; then | ||||
| # Create a symbolic link in folder_b with absolute paths | # Create a symbolic link in folder_b with absolute paths | ||||
| ln -s "../../node_modules/$1/$filename" "$destination" | |||||
| ln -s "$3../../node_modules/$1/$filename" "$destination" | |||||
| echo "Linked '../../node_modules/$1/$filename' to '$destination'" | echo "Linked '../../node_modules/$1/$filename' to '$destination'" | ||||
| else | else | ||||
| echo "File '$destination' already exists, skipping..." | echo "File '$destination' already exists, skipping..." | ||||
| # Example of calling the function on multiple folder pairs | # Example of calling the function on multiple folder pairs | ||||
| manage_files "chess-server-lib/common/models" "cihsr-server/cihsr/models" | |||||
| manage_files "chess-server-lib/common/lib/vmodel" "cihsr-server/cihsr/lib/vmodel" | |||||
| manage_files "chess-server-lib/common/models" "cihsr-server/cihsr/models" "" | |||||
| manage_files "chess-server-lib/common/lib/vmodel" "cihsr-server/cihsr/lib/vmodel" "../" | |||||
| rm "./cihsr-server/cihsr/models/labrtfresult.js" | rm "./cihsr-server/cihsr/models/labrtfresult.js" | ||||
| rm "./cihsr-server/cihsr/models/dataimport.js" | rm "./cihsr-server/cihsr/models/dataimport.js" |