Last active
June 21, 2023 04:28
-
-
Save xyulex/dc8557c96c0d106211fb3d9bc7f4afcc to your computer and use it in GitHub Desktop.
MOODLE SCRIPT: Crear SCORMS con imsmaanifest.xml, añadiendo el xml a la carpeta html y comprimiendo carpetas en zips
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
#!/bin/bash | |
for i in *; | |
do | |
if [ -d "$i" ]; then | |
cd "$i"; | |
for j in *; | |
do | |
if [ -d "$j" ]; then | |
cd "$j"; | |
orig="$j"; | |
mod=${orig//[_]/' '}; | |
var="<?xml version = '1.0'?><manifest identifier='Manifest' version='1.2' | |
xmlns='http://www.imsproject.org/xsd/imscp_rootv1p1p2' | |
xmlns:adlcp='http://www.adlnet.org/xsd/adlcp_rootv1p2' | |
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' | |
xsi:schemaLocation='http://www.imsproject.org/xsd/imscp_rootv1p1p2 imscp_rootv1p1p2.xsd | |
http://www.imsglobal.org/xsd/imsmd_rootv1p2p1 imsmd_rootv1p2p1.xsd | |
http://www.adlnet.org/xsd/adlcp_rootv1p2 adlcp_rootv1p2.xsd'> | |
<organizations default='Altamar'> | |
<organization identifier='Altamar'> | |
<title>${mod}</title> | |
<item identifier='Altamar_mod' isvisible='true' identifierref='Altamar_res'> | |
<title>${mod}</title> | |
</item> | |
</organization> | |
</organizations> | |
<resources> | |
<resource identifier='Altamar_res' type='webcontent' href='index.html' adlcp:scormtype='sco'> | |
<file href='index.html'/> | |
</resource> | |
</resources> | |
</manifest>"; | |
touch "imsmanifest.xml"; | |
echo "$var" > "imsmanifest.xml"; | |
zip -r "../${i}_${j}.zip" *; | |
fi | |
cd ..; | |
done; | |
cd ..; | |
fi | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
En estructura:
/libros
/Nombre_del_libro1
/Nombre_de_la_unidad_uno
/Nombre_de_la_unidad_dos
/Nombre_de_la_unidad_tres
/Nombre_del_libro2
/Nombre_de_la_unidad_uno
/Nombre_de_la_unidad_dos
/Nombre_de_la_unidad_tres
Crea un zip por directorio final.