Skip to content

Instantly share code, notes, and snippets.

@xyulex
Last active June 21, 2023 04:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xyulex/dc8557c96c0d106211fb3d9bc7f4afcc to your computer and use it in GitHub Desktop.
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
#!/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;
@xyulex
Copy link
Author

xyulex commented Jun 13, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment