Funciones de ficheros.
Funciones
Real FilCheckExtension(Text filPth, Text txtExt, Real casSen)Real FilCopy(Text oldPth, Text newPth, Real overwrite)//////////////////////////////////////////////////////////////////////////////
Real FilCheckExtension(Text filPth, // Ruta del fichero
Text txtExt, // Extension para comprobar
Real casSen) // Si distingue mayus/minus en extension
//////////////////////////////////////////////////////////////////////////////
{
Text filExt = If(casSen, GetFileExtension(filPth),
ToLower(GetFileExtension(filPth)));
Text chkExt = If(casSen, txtExt,
ToLower(txtExt));
filExt==chkExt
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna cierto si el fichero de ruta filPth tiene la extension txtExt.
Si casSen es cierto distingue entre mayusculas de minusculas.",
FilCheckExtension);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Real FilCopy(Text oldPth, // Ruta del fichero origen
Text newPth, // Ruta del fichero destino
Real overwrite) // Si cierto sobre-escribe
//////////////////////////////////////////////////////////////////////////////
{
Text cpyTxt = "copy "+oldPth+" "+newPth;
Text cpyCmd = Replace(cpyTxt, "/", "\\");
Case(
Not(FileExist(oldPth)), FALSE, // Original doesn't exist
oldPth==newPth, FALSE, // Auto-copy ?
Not(FileExist(newPth)), System(cpyCmd), // Execute copy
overwrite, System(cpyCmd), // Copy and overwrite
FALSE) // Don't overwrite
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns TRUE in the file oldNam can be copied over newNam.",
FilCopy);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// FILE : fil.tol
// AUTHOR : http://www.asolver.com
// PURPOSE : Funciones de ficheros.
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Real FilCheckExtension(Text filPth, // Ruta del fichero
Text txtExt, // Extension para comprobar
Real casSen) // Si distingue mayus/minus en extension
//////////////////////////////////////////////////////////////////////////////
{
Text filExt = If(casSen, GetFileExtension(filPth),
ToLower(GetFileExtension(filPth)));
Text chkExt = If(casSen, txtExt,
ToLower(txtExt));
filExt==chkExt
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna cierto si el fichero de ruta filPth tiene la extension txtExt.
Si casSen es cierto distingue entre mayusculas de minusculas.",
FilCheckExtension);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Real FilCopy(Text oldPth, // Ruta del fichero origen
Text newPth, // Ruta del fichero destino
Real overwrite) // Si cierto sobre-escribe
//////////////////////////////////////////////////////////////////////////////
{
Text cpyTxt = "copy "+oldPth+" "+newPth;
Text cpyCmd = Replace(cpyTxt, "/", "\\");
Case(
Not(FileExist(oldPth)), FALSE, // Original doesn't exist
oldPth==newPth, FALSE, // Auto-copy ?
Not(FileExist(newPth)), System(cpyCmd), // Execute copy
overwrite, System(cpyCmd), // Copy and overwrite
FALSE) // Don't overwrite
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns TRUE in the file oldNam can be copied over newNam.",
FilCopy);
//////////////////////////////////////////////////////////////////////////////
Omr.Forms construye las páginas web Html del sitio web omrforms.es
2015 asolver.com | Aviso legal | XHTML | Δ Θ Ξ | Creative Commons | Mapa y funciones del sitio