HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/topswtwmobile.komma.pro/scripts/export-lang.sh
#!/bin/bash
# This bash script uses laravel-lang-import-export
# https://github.com/ufirstgroup/laravel-lang-import-export
#

LANGUAGE="$1"

if [ -z "$LANGUAGE" ]; then
    echo "Please fill in the language to export"
    exit;
fi



#Find all the php files in the given language 
FILES=$(find ./app/lang/$LANGUAGE -type f -name '*.php')

#Loop trough the files
for f in $FILES
do
   
 	#cutt ./app/lang/{language}/ from the given path
 	temp_path="${f//.\/app\/lang\/$LANGUAGE\//}"
 	
 	

 	#cutt the .php to create the group variable
	group="${temp_path//.php/}"

	#create the dir path
	mk_dir_path=`echo $temp_path | perl -pe 's/\/?[a-zA-Z_]+.php//g'`

	
	#create the dir if it doesn't exist
	mkdir -p "export/$LANGUAGE/$mk_dir_path";

 	#execute the lang-export command
	php artisan lang-export:csv --delimiter=";" --enclosure='"' --output="/Projecten/Komma/KMS/v8/export/$LANGUAGE/"$group".csv" nl $group

	#echo witch file is exported
 	echo "Exported $temp_path to export/$LANGUAGE$mk_dir_path/$group.csv";
 	
done