<!DOCTYPE html>
<html lang="es" dir="ltr">
<head>
<base href="../../../../../">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Servicio ScriptForge.FileSystem</title>
<link rel="shortcut icon" href="media/navigation/favicon.ico">
<link type="text/css" href="normalize.css" rel="Stylesheet">
<link type="text/css" href="prism.css" rel="Stylesheet">
<link type="text/css" href="default.css" rel="Stylesheet">
<script type="text/javascript" src="polyfills.js"></script><script type="text/javascript" src="languages.js"></script><script type="text/javascript" src="es/langnames.js"></script><script type="text/javascript" src="flexsearch.debug.js"></script><script type="text/javascript" src="prism.js"></script><script type="text/javascript" src="help2.js" defer></script><script type="text/javascript" src="a11y-toggle.js" defer></script><script type="text/javascript" src="paginathing.js" defer></script><script type="text/javascript" src="es/bookmarks.js" defer></script><script type="text/javascript" src="es/contents.js" defer></script><script type="text/javascript" src="help.js" defer></script><meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<header id="TopLeftHeader"><a class="symbol" href="es/text/shared/05/new_help.html"><div></div></a><a class="logo" href="es/text/shared/05/new_help.html"><p dir="auto">Ayuda de LibreOffice 25.2</p></a><div class="dropdowns"><div class="modules">
<button type="button" data-a11y-toggle="modules-nav" id="modules" aria-haspopup="true" aria-expanded="false" aria-controls="modules-nav">Módulo</button><nav id="modules-nav" hidden=""></nav>
</div></div></header><aside class="leftside"><input id="accordion-1" name="accordion-menu" type="checkbox"><label for="accordion-1" dir="auto">Contenido</label><div id="Contents" class="contents-treeview"></div></aside><div id="SearchFrame"><div id="Bookmarks">
<input id="search-bar" type="search" class="search" placeholder="Buscar en los marcadores del módulo elegido" dir="auto"><div class="nav-container" tabindex="0"><nav class="index" dir="auto"></nav></div>
</div></div>
<div id="DisplayArea" itemprop="softwareHelp" itemscope="true" itemtype="http://schema.org/SoftwareApplication">
<noscript><div id="WarnJS"><h1 dir="auto">Active JavaScript en el navegador para mostrar las páginas de ayuda de LibreOffice.</h1></div></noscript>
<a id="ScriptForge-sf_filesystem"></a>
<a id="bm_id41582391760252"></a>
<meta itemprop="keywords" content="FileSystem service">
<a id="abstract"></a>
<h1 id="bm_id781582391760253" dir="auto">
<a id="FileSystemService"></a>Servicio <span class="literal">ScriptForge</span>.<span class="literal">FileSystem</span>
</h1>
<p id="par_id931583589764919" class="paragraph" dir="auto">The <span class="literal">FileSystem</span> service includes routines to handle files and folders. Next are some examples of the features provided by this service:</p>
<ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id121612917070593" class="listitem" dir="auto">Verify whether a file or folder exists.</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id121612917070594" class="listitem" dir="auto">Create and delete folders and files.</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id121612917070595" class="listitem" dir="auto">Launch dialog boxes to open/save files.</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id121612917070596" class="listitem" dir="auto">Access the list of files in a folder, etc.</p>
</li>
</ul>
<div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id121612917368946" dir="auto">The methods in the FileSystem service are mostly based on the <a target="_blank" href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1ucb_1_1XSimpleFileAccess.html"><span class="literal">XSimpleFileAccess</span> UNO interface.</a></p></div>
</div>
<br>
<h2 id="hd_id961583589783025" dir="auto">Definiciones</h2>
<p id="par_id821612988815351" class="paragraph" dir="auto">La tabla de más abajo enumera los principales parámetros que utiliza la mayoría de los métodos del servicio <span class="literal">FileSystem</span>.</p>
<table border="1" class="" cellpadding="0" cellspacing="0">
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id891612988600163" class="tableheadintable" dir="auto">Parámetro</p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id711612988600163" class="tableheadintable" dir="auto">Descripción</p>
</th>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id181612988600163" class="tablecontentintable" dir="auto"><span class="literal">FileName</span></p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id321612988600163" class="tablecontentintable" dir="auto">El nombre completo del archivo, la ruta incluida, sin esta incluir el separador de ruta al final.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id181612988600164" class="tablecontentintable" dir="auto"><span class="literal">FolderName</span></p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id321612988600165" class="tablecontentintable" dir="auto">El nombre completo de la carpeta, ruta incluida, con o sin el separador de ruta final.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id181612988600166" class="tablecontentintable" dir="auto"><span class="literal">Name</span></p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id321612988600167" class="tablecontentintable" dir="auto">The last component of the <span class="emph">Folder Name</span> or <span class="emph">File Name</span> including its extension. This parameter is always expressed using the native format of the operating system.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id181612988600168" class="tablecontentintable" dir="auto"><span class="literal">BaseName</span></p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id321612988600169" class="tablecontentintable" dir="auto">The last component of the <span class="emph">Folder Name</span> or <span class="emph">File Name</span> without its extension.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id181612988600171" class="tablecontentintable" dir="auto"><span class="literal">NamePattern</span></p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id321612988600172" class="tablecontentintable" dir="auto">Any of the above names containing wildcards in its last component. Admitted wildcards are:</p>
<ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id851583590809104" class="listitemintable" dir="auto">«?» representa cualquier carácter individual</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id161583590819320" class="listitemintable" dir="auto">«*» representa cero, uno o múltiples caracteres</p>
</li>
</ul>
</td>
</tr>
</table>
<br>
<div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id911584540527980" dir="auto">The <span class="literal">FileSystem</span> service allows to perform operations over multiple files at the same time. By using name patterns, user scripts can copy, move or delete multiple files. Conversely, Basic built-in methods can only handle single files.</p></div>
</div>
<br>
<h3 id="hd_id991612918109871" dir="auto">Notación para dar nombre a los archivos</h3>
<p id="par_id791612918141083" class="paragraph" dir="auto">The notation used to express file and folder names, both for arguments and returned values, is defined by the <span class="literal">FileNaming</span> property of the <span class="literal">FileSystem</span> service.</p>
<p id="par_id951612918220255" class="paragraph" dir="auto">In short, the possible representation types are "URL" (URL file notation), "SYS" (operating system notation) and "ANY" (default). See more information <a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#properties_toc">below</a>.</p>
<div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id861583589907100" dir="auto">Un ejemplo de notación de URL es <span class="emph">file:///C:/Documents/mi_archivo.odt</span>. Considere, siempre que sea posible, utilizar la notación de URL, dado que es una alternativa más portátil.</p></div>
</div>
<br>
<div class="warning">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/warning.svg" alt="warning" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id931626652451855" dir="auto">The use of the shortcut "~" (tilde), which is common in Linux-based operating systems, is not supported to express a path to a folder and file name. Instead of using <span class="emph">"~/Documents/my_file.odt"</span> use the full path <span class="emph">"/home/user/Documents/my_file.odt"</span>.</p></div>
</div>
<br>
<h2 id="hd_id581582885621841" dir="auto">Invocación del servicio</h2>
<p id="par_id691612990276070" class="paragraph" dir="auto">The following code snippet invokes the <span class="literal">FileSystem</span> service. The method <span class="literal">BuildPath</span> was used as an example.</p>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")
Dim FSO As Object
Set FSO = CreateScriptService("FileSystem")
FSO.BuildPath(...)
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
from scriptforge import CreateScriptService
fs = CreateScriptService("FileSystem")
fs.BuildPath(...)
</code></pre></div>
<a id="virtual_fs"></a>
<h2 id="hd_id981689594663689" dir="auto">Accessing the Virtual File System of a Document</h2>
<p id="par_id661689594721047" class="paragraph" dir="auto">LibreOffice document files are compressed ZIP files that contain the files and folders that represent the actual document contents. While the document is open, it is possible to access this virtual file system, explore its structure, as well as read and create files and folders.</p>
<p id="par_id891689594949717" class="paragraph" dir="auto">The following example shows how to create a text file named <span class="literal">myFile.txt</span> and store it inside the document's virtual file system.</p>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")
Dim oDoc As Object, fso As Object, oFile As Object
Dim sRoot, sFile, sMyDir
Set fso = CreateScriptService("FileSystem")
Set oDoc = CreateScriptService("Document", ThisComponent)
' Gets the URL path notation to the root of the virtual file system
sRoot = oDoc.FileSystem()
sMyDir = sRoot & "myDir"
' Creates the folder "myDir" if it does not exist
If Not fso.FolderExists(sMyDir) Then
fso.CreateFolder(sMyDir)
End If
' Creates the file and write some text into it
sFile = fso.BuildPath(sMyDir, "myFile.txt")
oFile = fso.CreateTextFile(sFile)
oFile.WriteLine("Hello!")
oFile.CloseFile()
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
from scriptforge import CreateScriptService
bas = CreateScriptService("Basic")
doc = CreateScriptService("Document", bas.ThisComponent)
fso = CreateScriptService("FileSystem")
sRoot = doc.FileSystem
sMyDir = sRoot + "myDir"
if not fso.FolderExists(sMyDir):
fso.CreateFolder(sMyDir)
sFile = fso.BuildPath(sMyDir, "myFile.txt")
oFile = fso.CreateTextFile(sFile)
oFile.WriteLine("Hello!")
oFile.CloseFile()
</code></pre></div>
<p id="par_id121689595522630" class="paragraph" dir="auto">In general, all methods of the <span class="literal">FileSystem</span> service can be used to manipulate files in the document's virtual file system. However, the following restrictions apply:</p>
<ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id321689595825516" class="listitem" dir="auto">It is not possible to create files in the root folder. Use existing subfolders or create new folders to store files in the document's file system.</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id861689595826432" class="listitem" dir="auto">The <span class="literal">FileNaming</span> notation is always considered to be "URL".</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id181689595826743" class="listitem" dir="auto">The methods <span class="literal">CompareFiles</span>, <span class="literal">GetFileModified</span>, <span class="literal">HashFile</span>, <span class="literal">PickFile</span> and <span class="literal">PickFolder</span> are not applicable.</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id361689595827152" class="listitem" dir="auto">The method <span class="literal">GetFileLen</span> always returns zero.</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id131689596237329" class="listitem" dir="auto">The method <span class="literal">Normalize</span> always returns the input string unchanged.</p>
</li>
</ul>
<div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id51689595641705" dir="auto">The path to the virtual file system is not a physical address on the computer's hard drive. It can only be accessed from within a LibreOffice script and it only exists while the document file is open.</p></div>
</div>
<br>
<a id="bm_id901612991354326"></a>
<meta itemprop="keywords" content="FileSystem service,FileNaming property">
<meta itemprop="keywords" content="FileSystem service,ConfigFolder property">
<meta itemprop="keywords" content="FileSystem service,ExtensionsFolder property">
<meta itemprop="keywords" content="FileSystem service,HomeFolder property">
<meta itemprop="keywords" content="FileSystem service,InstallFolder property">
<meta itemprop="keywords" content="FileSystem service,TemplatesFolder property">
<meta itemprop="keywords" content="FileSystem service,TemporaryFolder property">
<meta itemprop="keywords" content="FileSystem service,UserTemplatesFolder property">
<h2 id="hd_id651583668365757" dir="auto">Propiedades</h2>
<a id="properties_toc"></a>
<table border="1" class="" cellpadding="0" cellspacing="0">
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id871583668386455" class="tableheadintable" dir="auto">Nombre</p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id491583668386455" class="tableheadintable" dir="auto">De solo lectura</p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id271583668474014" class="tableheadintable" dir="auto">Tipo</p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id401583668386455" class="tableheadintable" dir="auto">Descripción</p>
</th>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id151583668386455" class="tablecontentintable" dir="auto">FileNaming</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id371583668519172" class="tablecontentintable" dir="auto">No</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id271583668386455" class="tablecontentintable" dir="auto">String</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id771583668386455" class="tablecontentintable" dir="auto">Establece o devuelve la notación actual de archivos y carpetas, la cual puede ser «ANY», «URL» o «SYS»:</p>
<ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id881585396501844" class="paragraphintable" dir="auto"><span class="emph">"ANY"</span>: (default) the methods of the <span class="literal">FileSystem</span> service accept both URL and current operating system's notation for input arguments but always return URL strings.</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id261583669091722" class="paragraphintable" dir="auto"><span class="emph">"URL"</span>: the methods of the <span class="literal">FileSystem</span> service expect URL notation for input arguments and return URL strings.</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id731583669120436" class="paragraphintable" dir="auto"><span class="emph">"SYS"</span>: the methods of the <span class="literal">FileSystem</span> service expect current operating system's notation for both input arguments and return strings.</p>
</li>
</ul>
<p id="par_id211583765169579" class="paragraphintable" dir="auto">Once set, the <span class="literal">FileNaming</span> property remains unchanged either until the end of the LibreOffice session or until it is set again.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id951583839708571" class="tablecontentintable" dir="auto">ConfigFolder</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id541583839708548" class="tablecontentintable" dir="auto">Sí</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id751583839708362" class="tablecontentintable" dir="auto">String</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id731583839708412" class="tablecontentintable" dir="auto">Devuelve la carpeta de configuración de LibreOffice.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id511584027709311" class="tablecontentintable" dir="auto">ExtensionsFolder</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id761584027709516" class="tablecontentintable" dir="auto">Sí</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id491584027709825" class="tablecontentintable" dir="auto">String</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id971584027709752" class="tablecontentintable" dir="auto">Devuelve la carpeta en que se instalan las extensiones.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id491583839767611" class="tablecontentintable" dir="auto">HomeFolder</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id31583839767743" class="tablecontentintable" dir="auto">Sí</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id741583839767926" class="tablecontentintable" dir="auto">String</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id111583839767195" class="tablecontentintable" dir="auto">Devuelve la carpeta personal del usuario.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id83158383992056" class="tablecontentintable" dir="auto">InstallFolder</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id771583839920487" class="tablecontentintable" dir="auto">Sí</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id971583839920282" class="tablecontentintable" dir="auto">String</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id451583839920858" class="tablecontentintable" dir="auto">Devuelve la carpeta de instalación de LibreOffice.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id751588333908795" class="tablecontentintable" dir="auto">TemplatesFolder</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id571588333908716" class="tablecontentintable" dir="auto">Sí</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id781588333908500" class="tablecontentintable" dir="auto">String</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id721588333908708" class="tablecontentintable" dir="auto">Devuelve la carpeta que contiene los archivos de plantillas de sistema.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id251583774433989" class="tablecontentintable" dir="auto">TemporaryFolder</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id501583774433513" class="tablecontentintable" dir="auto">Sí</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id411583774433779" class="tablecontentintable" dir="auto">String</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id71583774433459" class="tablecontentintable" dir="auto">Devuelve la carpeta de archivos temporales definida en la configuración de rutas de LibreOffice.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id731588334016220" class="tablecontentintable" dir="auto">UserTemplatesFolder</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id271588334016191" class="tablecontentintable" dir="auto">Sí</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id991588334016273" class="tablecontentintable" dir="auto">String</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id251588334016874" class="tablecontentintable" dir="auto">Returns the folder containing the user-defined template files.</p>
</td>
</tr>
</table>
<br>
<a id="methods_toc"></a>
<table border="1" class="" cellpadding="0" cellspacing="0">
<tr>
<th rowspan="" colspan="3" class="tableheadcell" dir="auto"><p id="par_id891611613601554" class="tableheadintable" dir="auto">Lista de métodos en el servicio FileSystem</p></th>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id891611613601556" class="tablecontentintable" dir="auto">
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#BuildPath">BuildPath</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#CompareFiles">CompareFiles</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#CopyFile">CopyFile</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#CopyFolder">CopyFolder</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#CreateFolder">CreateFolder</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#CreateTextFile">CreateTextFile</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#DeleteFile">DeleteFile</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#DeleteFolder">DeleteFolder</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#ExtensionFolder">ExtensionFolder</a><br>
</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id541611613601554" class="tablecontentintable" dir="auto">
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#FileExists">FileExists</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#Files">Files</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#FolderExists">FolderExists</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#GetBaseName">GetBaseName</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#GetExtension">GetExtension</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#GetFileLen">GetFileLen</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#GetFileModified">GetFileModified</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#GetName">GetName</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#GetParentFolderName">GetParentFolderName</a><br>
</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id701611613601554" class="tablecontentintable" dir="auto">
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#GetTempName">GetTempName</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#HashFile">HashFile</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#MoveFile">MoveFile</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#MoveFolder">MoveFolder</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#Normalize">Normalize</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#OpenTextFile">OpenTextFile</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#PickFile">PickFile</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#PickFolder">PickFolder</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#SubFolders">SubFolders</a><br>
</p>
</td>
</tr>
</table>
<br>
<a id="BuildPath"></a>
<a id="bm_id721583933076548"></a>
<meta itemprop="keywords" content="FileSystem service,BuildPath">
<h2 id="hd_id681583933076692" dir="auto">BuildPath</h2>
<p id="par_id871583933076448" class="paragraph" dir="auto">Joins a folder path and the name of a file and returns the full file name with a valid path separator. The path separator is added only if necessary.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id251626147640389" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.BuildPath(foldername: str, name: str): str</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id90158393307695" class="paragraph" dir="auto"><span class="emph">foldername</span>: The path with which <span class="literal">name</span> will be combined. The specified path does not need to be an existing folder.</p>
<p id="par_id891583933076975" class="paragraph" dir="auto"><span class="emph">name</span>: The name of the file to be appended to <span class="literal">foldername</span>. This parameter uses the notation of the current operating system.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
Dim FSO as Object
Set FSO = CreateScriptService("FileSystem")
Dim aFileName as String
FSO.FileNaming = "URL"
aFileName = FSO.BuildPath("file:///home/user", "sample file.odt")
' file:///home/user/sample%20file.odt
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
fs = CreateScriptService("FileSystem")
fs.FileNaming = "URL"
aFileName = fs.BuildPath("file:///home/user", "sample file.odt")
# file:///home/user/sample%20file.odt
</code></pre></div>
<a id="CompareFiles"></a>
<a id="bm_id141601118910914"></a>
<meta itemprop="keywords" content="FileSystem service,CompareFiles">
<h2 id="hd_id441601118910655" dir="auto">CompareFiles</h2>
<p id="par_id33160111891079" class="paragraph" dir="auto">Compares two files and returns <span class="literal">True</span> when they seem identical.</p>
<p id="par_id631601119001315" class="paragraph" dir="auto">Depending on the value of the <span class="literal">comparecontents</span> argument, the comparison between both files can be either based only on file attributes (such as the last modified date), or based on the file contents.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id61626148854349" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.CompareFiles(filename1: str, filename2: str, comparecontents: bool = False): bool</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id481601118910755" class="paragraph" dir="auto"><span class="emph">filename1, filename2</span>: The files to compare.</p>
<p id="par_id111601118910848" class="paragraph" dir="auto"><span class="emph">comparecontents</span>: When <span class="literal">True</span>, the contents of the files are compared (default = <span class="literal">False</span>).</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
FSO.FileNaming = "SYS"
If FSO.CompareFiles("C:\myFile1.txt", "C:\myFile2.txt", CompareContents := False) Then
' ...
End If
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
fs.FileNaming = "SYS"
if fs.CompareFiles(r"C:\myFile1.txt", r"C:\myFile2.txt", comparecontents = False):
# ...
</code></pre></div>
<a id="CopyFile"></a>
<a id="bm_id41584541257826"></a>
<meta itemprop="keywords" content="FileSystem service,CopyFile">
<h2 id="hd_id95158454125767" dir="auto">CopyFile</h2>
<p id="par_id161584541257982" class="paragraph" dir="auto">Copies one or more files from one location to another. Returns <span class="literal">True</span> if at least one file has been copied or <span class="literal">False</span> if an error occurred.</p>
<p id="par_id401612998805699" class="paragraph" dir="auto">An error will also occur if the <span class="literal">source</span> parameter uses wildcard characters and does not match any files.</p>
<p id="par_id331612998814805" class="paragraph" dir="auto">El método se para inmediatamente después de que encuentra un error. El método no se revierte ni se deshacen los cambios efectuados antes de ocurrir el error.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id611626148998301" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.CopyFile(source: str, destination: str, overwrite: bool = True): bool</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id1001584541257789" class="paragraph" dir="auto"><span class="emph">source</span>: It can be a <span class="literal">FileName</span> or a <span class="literal">NamePattern</span> indicating one or more files to be copied.</p>
<p id="par_id111584542310166" class="paragraph" dir="auto"><span class="emph">destination</span>: It can be either a <span class="literal">FileName</span> specifying where the single <span class="literal">source</span> file is to be copied, or a <span class="literal">FolderName</span> into which the multiple files from <span class="literal">source</span> are to be copied.</p>
<ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id491612999134752" class="paragraph" dir="auto">If <span class="literal">destination</span> does not exist, it is created.</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id591612999166788" class="paragraph" dir="auto">Wildcard characters are not allowed in <span class="literal">destination</span>.</p>
</li>
</ul>
<p id="par_id251584542431558" class="paragraph" dir="auto"><span class="emph">overwrite</span>: If <span class="literal">True</span> (default), files may be overwritten. The method will fail if <span class="literal">destination</span> is readonly, regardless of the value specified in <span class="literal">overwrite</span>.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<p id="par_id691626216252568" class="paragraph" dir="auto">In the examples below the first line copies a single file whereas the second line copies multiple files using wildcards.</p>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
FSO.CopyFile("C:\Documents\my_file.odt", "C:\Temp\copied_file.odt")
FSO.CopyFile("C:\Documents\*.*", "C:\Temp\", Overwrite := False)
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
fs.CopyFile(r"C:\Documents\my_file.odt", r"C:\Temp\copied_file.odt")
fs.CopyFile(r"C:\Documents\*.*", r"C:\Temp", overwrite = False)
</code></pre></div>
<div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id411626216328023" dir="auto">Conviene tener presente que las subcarpetas y sus contenidos no se copian cuando se utilizan comodines en el argumento <span class="emph">source</span>.</p></div>
</div>
<br>
<a id="CopyFolder"></a>
<a id="bm_id661584544734386"></a>
<meta itemprop="keywords" content="FileSystem service,CopyFolder">
<h2 id="hd_id201584544734113" dir="auto">CopyFolder</h2>
<p id="par_id731584544734412" class="paragraph" dir="auto">Copies one or more folders from one location to another. Returns <span class="literal">True</span> if at least one folder has been copied or <span class="literal">False</span> if an error occurred.</p>
<p id="par_id21612999775377" class="paragraph" dir="auto">An error will also occur if the <span class="literal">source</span> parameter uses wildcard characters and does not match any folders.</p>
<p id="par_id701612999808912" class="paragraph" dir="auto">El método se para inmediatamente después de que encuentra un error. El método no se revierte ni se deshacen los cambios efectuados antes de ocurrir el error.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id381626149136823" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.CopyFolder(source: str, destination: str, overwrite: bool = True): bool</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id851584544734202" class="paragraph" dir="auto"><span class="emph">source</span>: It can be a <span class="literal">FolderName</span> or a <span class="literal">NamePattern</span> indicating one or more folders to be copied.</p>
<p id="par_id321584544734273" class="paragraph" dir="auto"><span class="emph">destination</span>: Specifies the <span class="literal">FolderName</span> into which the single or multiple folders defined in <span class="literal">source</span> are to be copied.</p>
<ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id491612999134762" class="paragraph" dir="auto">If <span class="literal">destination</span> does not exist, it is created.</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id591612999166740" class="paragraph" dir="auto">Wildcard characters are not allowed in <span class="literal">destination</span>.</p>
</li>
</ul>
<p id="par_id251584542431525" class="paragraph" dir="auto"><span class="emph">overwrite</span>: If <span class="literal">True</span> (default), files may be overwritten. The method will fail if <span class="literal">destination</span> is readonly, regardless of the value specified in <span class="literal">overwrite</span>.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<p id="par_id751626216627481" class="paragraph" dir="auto">En los ejemplos siguientes, todos los archivos, carpetas y subcarpetas se copian.</p>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
' Basic
FSO.CopyFolder("C:\Documents\*", "C:\Temp\", Overwrite := False)
</code></pre></div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
# Python
fs.CopyFolder(r"C:\Documents\*", r"C:\Temp", overwrite = False)
</code></pre></div>
<a id="CreateFolder"></a>
<a id="bm_id95158454067521"></a>
<meta itemprop="keywords" content="FileSystem service,CreateFolder">
<h2 id="hd_id501584540675285" dir="auto">CreateFolder</h2>
<p id="par_id31158454067562" class="paragraph" dir="auto">Creates the specified <span class="literal">FolderName</span>. Returns <span class="literal">True</span> if the folder could be successfully created.</p>
<p id="par_id431613000475359" class="paragraph" dir="auto">If the specified folder has a parent folder that does not exist, it is created.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id531626177201641" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.CreateFolder(foldername: str): bool</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id491584540675469" class="paragraph" dir="auto"><span class="emph">foldername</span>: A string representing the folder to be created. If the folder already exists, an exception will be raised.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
' Basic
FSO.CreateFolder("C:\NewFolder")
</code></pre></div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
# Python
fs.CreateFolder(r"C:\NewFolder")
</code></pre></div>
<a id="CreateTextFile"></a>
<a id="bm_id651585322689546"></a>
<meta itemprop="keywords" content="FolderSystem service,CreateTextFile">
<h2 id="hd_id19158532268911" dir="auto">CreateTextFile</h2>
<p id="par_id731585322689518" class="paragraph" dir="auto">Creates a specified file and returns a <span class="literal">TextStream</span> service instance that can be used to write to the file.</p>
<p id="par_id821613001057759" class="paragraph" dir="auto">The method returns a <span class="literal">Null</span> object if an error occurred.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id431626178025633" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.CreateTextFile(filename: str, overwrite: bool = True, encoding: str = 'UTF-8'): svc</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id901585322689715" class="paragraph" dir="auto"><span class="emph">filename</span>: The name of the file to be created.</p>
<p id="par_id501585322689209" class="paragraph" dir="auto"><span class="emph">overwrite</span>: Boolean value that determines if <span class="literal">filename</span> can be overwritten (default = <span class="literal">True</span>).</p>
<p id="par_id551585322689192" class="paragraph" dir="auto"><span class="emph">encoding</span>: The character set to be used. The default encoding is "UTF-8".</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
Dim myFile As Object
FSO.FileNaming = "SYS"
Set myFile = FSO.CreateTextFile("C:\Temp\ThisFile.txt", Overwrite := True)
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
fs.FileNaming = "SYS"
myFile = fs.CreateTextFile(r"C:\Temp\ThisFile.txt", overwrite = True)
</code></pre></div>
<div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id141613001281573" dir="auto">Para conocer más sobre los nombres de los conjuntos de caracteres, consulte la página <a target="_blank" href="https://www.iana.org/assignments/character-sets/character-sets.xhtml">Conjuntos de caracteres de la IANA</a> (en inglés). Conviene saber que LibreOffice no admite todos los conjuntos de caracteres existentes.</p></div>
</div>
<br>
<a id="DeleteFile"></a>
<a id="bm_id421584882040621"></a>
<meta itemprop="keywords" content="FileSystem service,DeleteFile">
<h2 id="hd_id191584882040749" dir="auto">DeleteFile</h2>
<p id="par_id11584882040881" class="paragraph" dir="auto">Elimina uno o más archivos. Devuelve <span class="literal">True</span> si al menos un archivo se ha eliminado, o bien, <span class="literal">False</span>, si se ha producido un error.</p>
<p id="par_id21612999775356" class="paragraph" dir="auto">An error will also occur if the <span class="literal">filename</span> parameter uses wildcard characters and does not match any files.</p>
<p id="par_id21613001848493" class="paragraph" dir="auto">The files to be deleted must not be readonly.</p>
<p id="par_id701612999808832" class="paragraph" dir="auto">El método se para inmediatamente después de que encuentra un error. El método no se revierte ni se deshacen los cambios efectuados antes de ocurrir el error.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id11626178195995" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.DeleteFile(filename: str): bool</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id441584882040860" class="paragraph" dir="auto"><span class="emph">filename</span>: It can be a <span class="literal">FileName</span> or a <span class="literal">NamePattern</span> indicating one or more files to be deleted.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<p id="par_id851626217167909" class="paragraph" dir="auto">In the examples below only files are deleted, subfolders are not deleted.</p>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
' Basic
FSO.DeleteFile("C:\Temp\*.docx")
</code></pre></div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
# Python
fs.DeleteFile(r"C:\Temp\*.docx")
</code></pre></div>
<a id="DeleteFolder"></a>
<a id="bm_id91584882542710"></a>
<meta itemprop="keywords" content="FileSystem service,DeleteFolder">
<h2 id="hd_id151584882542309" dir="auto">DeleteFolder</h2>
<p id="par_id11584882015881" class="paragraph" dir="auto">Deletes one or more folders. Returns <span class="literal">True</span> if at least one folder has been deleted or <span class="literal">False</span> if an error occurred.</p>
<p id="par_id21612999775346" class="paragraph" dir="auto">An error will also occur if the <span class="literal">foldername</span> parameter uses wildcard characters and does not match any folders.</p>
<p id="par_id21613001848853" class="paragraph" dir="auto">Las carpetas que se eliminarán no deben ser de solo lectura.</p>
<p id="par_id701612999808842" class="paragraph" dir="auto">El método se para inmediatamente después de que encuentra un error. El método no se revierte ni se deshacen los cambios efectuados antes de ocurrir el error.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id61626178267917" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.DeleteFolder(foldername: str): bool</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id451584882542247" class="paragraph" dir="auto"><span class="emph">foldername</span>: It can be a <span class="literal">FolderName</span> or a <span class="literal">NamePattern</span> indicating one or more folders to be deleted.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<p id="par_id651626217314709" class="paragraph" dir="auto">In the examples below only folders and their contents are deleted. Files in the parent folder "C:\Temp" are not deleted.</p>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
' Basic
FSO.DeleteFolder("C:\Temp\*")
</code></pre></div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
# Python
fs.DeleteFolder(r"C:\Temp\*")
</code></pre></div>
<a id="ExtensionFolder"></a>
<a id="bm_id91584882542365"></a>
<meta itemprop="keywords" content="FileSystem service,ExtensionFolder">
<h2 id="hd_id151584882542104" dir="auto">ExtensionFolder</h2>
<p id="par_id11584882015025" class="paragraph" dir="auto">Returns a string containing the folder where the specified extension package is installed.</p>
<div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id711658780480236" dir="auto">El valor actual de la propiedad <span class="literal">SF_FileSystem.FileNaming</span> se utiliza para determinar la notación de la cadena devuelta.</p></div>
</div>
<br>
<div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id891644442917193" dir="auto">Use the property <a target="_top" href="es/text/sbasic/shared/03/sf_platform.html#hd_id711600788076834"><span class="literal">Extensions</span></a> from the <span class="literal">Platform</span> service to get string array with the IDs of all installed extensions.</p></div>
</div>
<br>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id61626178211365" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.ExtensionFolder(extension: str): str</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id451584882542121" class="paragraph" dir="auto"><span class="emph">extension</span>: A string value with the ID of the extension. If the extension is not installed, an exception is raised.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<p id="par_id651626217313369" class="paragraph" dir="auto">The examples below in Basic and Python return the folder where the APSO extension is installed.</p>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
' Basic
sFolder = FSO.ExtensionFolder("apso.python.script.organizer")
' file:///home/username/.config/libreoffice/4/user/uno_packages/cache/uno_packages/lu10833wz3u2i.tmp_/apso_1_2_7.oxt
</code></pre></div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
# Python
sFolder = fs.ExtensionFolder("apso.python.script.organizer")
</code></pre></div>
<a id="FileExists"></a>
<a id="bm_id571583764426508"></a>
<meta itemprop="keywords" content="FileSystem service,FileExists">
<h2 id="hd_id39158376442641" dir="auto">FileExists</h2>
<p id="par_id161583764426709" class="paragraph" dir="auto">Devuelve <span class="literal">True</span> si un nombre de archivo indicado es válido y existe; si no, el método devuelve <span class="literal">False</span>.</p>
<p id="par_id91613003122613" class="paragraph" dir="auto">If the <span class="literal">filename</span> parameter is actually an existing folder name, the method returns <span class="literal">False</span>.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id201626178344527" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.FileExists(filename: str): bool</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id361583764426547" class="paragraph" dir="auto"><span class="emph">filename</span>: A string representing the file to be tested.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
FSO.FileNaming = "SYS"
If FSO.FileExists("C:\Documents\my_file.odt") Then
'...
End If
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
fs.FileNaming = "SYS"
if fs.FileExists(r"C:\Documents\my_file.odt"):
# ...
</code></pre></div>
<a id="Files"></a>
<a id="bm_id771583944327771"></a>
<meta itemprop="keywords" content="FileSystem service,Files">
<h2 id="hd_id461583944327647" dir="auto">Files</h2>
<p id="par_id11158394432779" class="paragraph" dir="auto">Returns a zero-based array of the files stored in a given folder. Each entry in the array is a string containing the full path and file name.</p>
<p id="par_id641613003790120" class="paragraph" dir="auto">If the argument <span class="literal">foldername</span> specifies a folder that does not exist, an exception is raised.</p>
<p id="par_id821613003779799" class="paragraph" dir="auto">Es posible filtrar la lista resultante mediante comodines.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id211626178396995" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.Files(foldername: str, filter: str = '', includesubfolders: bool = False): str[0..*]</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id731583944543140" class="paragraph" dir="auto"><span class="emph">foldername</span>: A string representing a folder. The folder must exist. This argument must not designate a file.</p>
<p id="par_id591585648450060" class="paragraph" dir="auto"><span class="emph">filter</span>: A string containing wildcards ("?" and "*") that will be applied to the resulting list of files (default = "").</p>
<p id="par_id731583944543907" class="paragraph" dir="auto"><span class="emph">includesubfolders</span>: Set this argument to <span class="literal">True</span> to include the contents of subfolders (Default = <span class="literal">False</span>).</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
Dim filesList As Variant, file As String
FSO.FileNaming = "SYS"
' Returns all files matching the "*.txt" filter, including files in subfolders
filesList = FSO.Files("/home/user/", "*.txt", IncludeSubfolders := True)
For Each file In filesList
' ...
Next file
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
fs.FileNaming = "SYS"
filesList = fs.Files("/home/user/", "*.txt", includesubfolders = True)
for file in fileList:
# ...
</code></pre></div>
<a id="FolderExists"></a>
<a id="bm_id11583765642643"></a>
<meta itemprop="keywords" content="FileSystem service,FolderExists">
<h2 id="hd_id421583765642360" dir="auto">FolderExists</h2>
<p id="par_id51583765642590" class="paragraph" dir="auto">Devuelve <span class="literal">True</span> si el <span class="literal">FolderName</span> especificado es válido y existe; si no, el método devuelve <span class="literal">False</span>.</p>
<p id="par_id151613004111990" class="paragraph" dir="auto">If the <span class="literal">foldername</span> parameter is actually an existing file name, the method returns <span class="literal">False</span>.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id451626270785443" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.FolderExists(foldername: str): bool</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id1001583765642211" class="paragraph" dir="auto"><span class="emph">foldername</span>: A string representing the folder to be tested.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
FSO.FileNaming = "SYS"
If FSO.FolderExists("C:\Documents\Thesis") Then
'...
End If
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
fs.FileNaming = "SYS"
if fs.FolderExists(r"C:\Documents\Thesis")
# ...
</code></pre></div>
<a id="GetBaseName"></a>
<a id="bm_id54158411061866"></a>
<meta itemprop="keywords" content="FileSystem service,GetBaseName">
<h2 id="hd_id111584110618587" dir="auto">GetBaseName</h2>
<p id="par_id521584110618989" class="paragraph" dir="auto">Returns the <span class="literal">BaseName</span> (equal to the last component) of a folder or file name, without its extension.</p>
<p id="par_id731613004316790" class="paragraph" dir="auto">El método no comprueba si existe el archivo o la carpeta que se especificó.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id301626178954105" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.GetBaseName(filename: str): str</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id691584110618308" class="paragraph" dir="auto"><span class="emph">filename</span>: A string representing the file name and its path.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<p id="par_id1001626271201609" class="paragraph" dir="auto">In the examples below, the first <span class="literal">GetBaseName</span> method call corresponds to a folder, so the function returns the last component of the path. The second call receives a file name as input, so the name of the file is returned without its extension.</p>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
MsgBox FSO.GetBaseName("/home/user/Documents") ' "Documents"
MsgBox FSO.GetBaseName("/home/user/Documents/my_file.ods") ' "my_file"
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
bas = CreateScriptService("Basic")
bas.MsgBox(fs.GetBaseName("/home/user/Documents")) # "Documents"
bas.MsgBox(fs.GetBaseName("/home/user/Documents/my_file.ods")) # "my_file"
</code></pre></div>
<a id="GetExtension"></a>
<a id="bm_id271584032680645"></a>
<meta itemprop="keywords" content="FileSystem service,GetExtension">
<h2 id="hd_id441584032680932" dir="auto">GetExtension</h2>
<p id="par_id831584032680866" class="paragraph" dir="auto">Returns the extension part of a file or folder name without the dot "." character.</p>
<p id="par_id941613060736524" class="paragraph" dir="auto">El método no comprueba la existencia del archivo o la carpeta que se haya especificado.</p>
<p id="par_id561613060896361" class="paragraph" dir="auto">If this method is applied to a folder name or to a file without an extension, then an empty string is returned.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id481626179171535" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.GetExtension(filename: str): str</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id821584032680311" class="paragraph" dir="auto"><span class="emph">filename</span>: A string representing the file name and its path.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
' Basic
ext = FSO.GetExtension("C:\Windows\Notepad.exe") ' "exe"
</code></pre></div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
# Python
ext = fs.GetExtension(r"C:\Windows\Notepad.exe") # "exe"
</code></pre></div>
<a id="GetFileLen"></a>
<a id="bm_id511600685050691"></a>
<meta itemprop="keywords" content="FileSystem service,GetFileLen">
<h2 id="hd_id301600685050869" dir="auto">GetFileLen</h2>
<p id="par_id48160068505010" class="paragraph" dir="auto">The builtin <span class="literal">FileLen</span> Basic function returns the number of bytes contained in a file as a <span class="literal">Long</span> value, i.e. up to 2GB.</p>
<p id="par_id571613061005426" class="paragraph" dir="auto">The <span class="literal">GetFileLen</span> method can handle files with much larger sizes by returning a <span class="literal">Currency</span> value.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id1001626179285915" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.GetFileLen(filename: str): num</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id161600685050367" class="paragraph" dir="auto"><span class="emph">filename</span>: A string representing an existing file.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
Dim fLen As Currency
FSO.FileNaming = "SYS"
fLen = FSO.GetFileLen("C:\pagefile.sys")
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
fs.FileNaming = "SYS"
fLen = fs.GetFileLen(r"C:\pagefile.sys")
</code></pre></div>
<a id="GetFileModified"></a>
<a id="bm_id901584811478304"></a>
<meta itemprop="keywords" content="FileSystem service,GetFileModified">
<h2 id="hd_id651584811478113" dir="auto">GetFileModified</h2>
<p id="par_id191584811478936" class="paragraph" dir="auto">Devuelve la fecha de última modificación de un archivo determinado.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id491626179415178" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.GetFileModified(filename: str): datetime</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id25158481147822" class="paragraph" dir="auto"><span class="emph">filename</span>: A string representing an existing file.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
Dim aDate As Date
FSO.FileNaming = "SYS"
aDate = FSO.GetFileModified("C:\Documents\my_file.odt")
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
fs.FileNaming = "SYS"
aDate = FSO.GetFileModified(r"C:\Documents\my_file.odt")
</code></pre></div>
<a id="GetName"></a>
<a id="bm_id501584032366770"></a>
<meta itemprop="keywords" content="FileSystem service,GetName">
<h2 id="hd_id761584032366379" dir="auto">GetName</h2>
<p id="par_id711584032366587" class="paragraph" dir="auto">Returns the last component of a file or folder name in native operating system format.</p>
<p id="par_id541613061300811" class="paragraph" dir="auto">El método no comprueba si existe el archivo o la carpeta que se especificó.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id601626179529154" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.GetName(filename: str): str</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id671584032366193" class="paragraph" dir="auto"><span class="emph">filename</span>: A string representing the file name and its path.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
' Basic
a = FSO.GetName("C:\Windows\Notepad.exe") ' Notepad.exe
</code></pre></div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
# Python
a = fs.GetName(r"C:\Windows\Notepad.exe") # Notepad.exe
</code></pre></div>
<a id="GetParentFolderName"></a>
<a id="bm_id211584113432829"></a>
<meta itemprop="keywords" content="FileSystem service,GetParentFolderName">
<h2 id="hd_id94158411343258" dir="auto">GetParentFolderName</h2>
<p id="par_id871584113432747" class="paragraph" dir="auto">Returns a string containing the name of the parent folder of a specified file or folder name.</p>
<p id="par_id611613061603039" class="paragraph" dir="auto">El método no comprueba si existe el archivo o la carpeta que se especificó.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id791626179605250" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.GetParentFolderName(filename: str): str</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id471584113432231" class="paragraph" dir="auto"><span class="emph">filename</span>: A string with the file or folder name to be analyzed.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
' Basic
a = FSO.GetParentFolderName("C:\Windows\Notepad.exe") ' C:\Windows\
</code></pre></div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
# Python
a = fs.GetParentFolderName(r"C:\Windows\Notepad.exe") # C:\Windows\
</code></pre></div>
<a id="GetTempName"></a>
<a id="bm_id621583851172862"></a>
<meta itemprop="keywords" content="FileSystem service,GetTempName">
<h2 id="hd_id981583851172348" dir="auto">GetTempName</h2>
<p id="par_id82158385117289" class="paragraph" dir="auto">Returns a randomly generated temporary file name that is useful for performing operations that require a temporary file.</p>
<p id="par_id391613061770924" class="paragraph" dir="auto">By default, the returned file name does not have an extension. Use the <span class="literal">extension</span> parameter to specify the extension of the file name to be generated.</p>
<p id="par_id251689599133544" class="paragraph" dir="auto">The folder part of the returned string is the system's temporary folder.</p>
<p id="par_id971613061774934" class="paragraph" dir="auto">El método no crea el archivo temporal.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id81626212807031" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.GetTempName(extension: str): str</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id471584113435991" class="paragraph" dir="auto"><span class="emph">extension</span>: The extension of the temporary file name (Default = "").</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
Dim fName As String
FSO.FileNaming = "SYS"
fName = FSO.GetTempName(Extension := "txt")
' "/tmp/SF_574068.txt"
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
fs.FileNaming = "SYS"
fName = FSO.GetTempName(extension = "txt")
# "/tmp/SF_574068.txt"
</code></pre></div>
<a id="HashFile"></a>
<a id="bm_id771601042514294"></a>
<meta itemprop="keywords" content="FileSystem service,HashFile">
<h2 id="hd_id251601042514585" dir="auto">HashFile</h2>
<p id="par_id58160104251423" class="paragraph" dir="auto">Hash functions are used by some cryptographic algorithms, in digital signatures, message authentication codes, fraud detection, fingerprints, checksums (message integrity check), hash tables, password storage and much more.</p>
<p id="par_id301601042791356" class="paragraph" dir="auto">The <span class="literal">HashFile</span> method returns the result of a hash function, applied on a given file and using a specified algorithm. The returned value is a string of lower-case hexadecimal digits.</p>
<p id="par_id861601043268484" class="paragraph" dir="auto">The hash algorithms supported are: <span class="literal">MD5</span>, <span class="literal">SHA1</span>, <span class="literal">SHA224</span>, <span class="literal">SHA256</span>, <span class="literal">SHA384</span> and <span class="literal">SHA512</span>.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id311626212875189" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.HashFile(filename: str, algorithm: str): str</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id28160104251451" class="paragraph" dir="auto"><span class="emph">filename</span>: A string representing an existing file.</p>
<p id="par_id71601042959846" class="paragraph" dir="auto"><span class="emph">algorithm</span>: One of the supported algorithms.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
' Basic
sHash = FSO.HashFile("C:\pagefile.sys", "MD5")
</code></pre></div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
# Python
sHash = FSO.HashFile(r"C:\pagefile.sys", "MD5")
</code></pre></div>
<a id="MoveFile"></a>
<a id="bm_id41584791330923"></a>
<meta itemprop="keywords" content="FileSystem service,MoveFile">
<h2 id="hd_id321584791330580" dir="auto">MoveFile</h2>
<p id="par_id51584791330688" class="paragraph" dir="auto">Moves one or more files from one location to another. Returns <span class="literal">True</span> if at least one file has been moved or <span class="literal">False</span> if an error occurred.</p>
<p id="par_id631613062890648" class="paragraph" dir="auto">An error will also occur if the <span class="literal">source</span> parameter uses wildcard characters and does not match any files.</p>
<p id="par_id241613062902777" class="paragraph" dir="auto">El método se para inmediatamente después de que encuentra un error. El método no se revierte ni se deshacen los cambios efectuados antes de ocurrir el error.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id851626214194605" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.MoveFile(source: str, destination: str): bool</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id721584791330406" class="paragraph" dir="auto"><span class="emph">source</span>: It can be a <span class="literal">FileName</span> or <span class="literal">NamePattern</span> to designate one or more files to be moved.</p>
<p id="par_id291584791330181" class="paragraph" dir="auto"><span class="emph">destination</span>: If <span class="literal">source</span> is a <span class="literal">FileName</span> then this parameter indicates the new path and file name of the moved file.</p>
<p id="par_id31613063334246" class="paragraph" dir="auto">If the move operation involves multiple files, then <span class="literal">destination</span> must be a folder name. If it does not exist, it is created.</p>
<p id="par_id391613063494599" class="paragraph" dir="auto">If <span class="literal">source</span> and <span class="literal">destination</span> have the same parent folder, the method will rename the <span class="literal">source</span>.</p>
<p id="par_id941613063476533" class="paragraph" dir="auto">Wildcard characters are not allowed in <span class="literal">destination</span>.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<p id="par_id91626272612758" class="paragraph" dir="auto">En los ejemplos siguientes se mueven solo los archivos, no las subcarpetas.</p>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
' Basic
FSO.MoveFile("C:\Temp1\*.*", "C:\Temp2")
</code></pre></div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
# Python
fs.MoveFile(r"C:\Temp1\*.*", r"C:\Temp2")
</code></pre></div>
<a id="MoveFolder"></a>
<a id="bm_id141584791330310"></a>
<meta itemprop="keywords" content="FolderSystem service,MoveFolder">
<h2 id="hd_id221584791330200" dir="auto">MoveFolder</h2>
<p id="par_id301584791330868" class="paragraph" dir="auto">Moves one or more folders from one location to another. Returns <span class="literal">True</span> if at least one folder has been moved or <span class="literal">False</span> if an error occurred.</p>
<p id="par_id411613072570664" class="paragraph" dir="auto">An error will also occur if the <span class="literal">source</span> parameter uses wildcard characters and does not match any folders.</p>
<p id="par_id601613072595264" class="paragraph" dir="auto">El método se para inmediatamente después de que encuentra un error. El método no se revierte ni se deshacen los cambios efectuados antes de ocurrir el error.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id181626214342806" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.MoveFolder(source: str, destination: str): bool</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id541584791330777" class="paragraph" dir="auto"><span class="emph">source</span>: It can be a <span class="literal">FolderName</span> or <span class="literal">NamePattern</span> to designate one or more folders to be moved.</p>
<p id="par_id551584791330279" class="paragraph" dir="auto"><span class="emph">destination</span>: If the move operation involves a single folder, then <span class="literal">destination</span> is the name and path of the moved folder and it must not exist.</p>
<p id="par_id11613072890641" class="paragraph" dir="auto">If multiple folders are being moved, then <span class="literal">destination</span> designates where the folders in <span class="literal">source</span> will be moved into. If <span class="literal">destination</span> does not exist, it is created.</p>
<p id="par_id301613072928159" class="paragraph" dir="auto">Wildcard characters are not allowed in <span class="literal">destination</span>.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
' Basic
FSO.MoveFolder("C:\Temp1\*", "C:\Temp2")
</code></pre></div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
# Python
fs.MoveFolder(r"C:\Temp1\*", r"C:\Temp2")
</code></pre></div>
<a id="Normalize"></a>
<a id="bm_id1001583670342602"></a>
<meta itemprop="keywords" content="FileSystem service,Normalize">
<h2 id="hd_id421583670341541" dir="auto">Normalize</h2>
<p id="par_id871583670342051" class="paragraph" dir="auto">Returns a string containing the normalized path name by collapsing redundant separators and up-level references.</p>
<p id="par_id541658780038027" class="paragraph" dir="auto">For instance, the path names <span class="literal">A//B</span>, <span class="literal">A/B/</span>, <span class="literal">A/./B</span> and <span class="literal">A/foo/../B</span> are all normalized to <span class="literal">A/B</span>.</p>
<p id="par_id881613074436118" class="paragraph" dir="auto">En Windows, las barras (/) se convierten en contrabarras (\).</p>
<div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id381658780455018" dir="auto">The current value of the property <span class="literal">SF_FileSystem.FileNaming</span> is used to determine the notation of the <span class="literal">filename</span> argument as well as the format of the returned string.</p></div>
</div>
<br>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id751626214682583" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.Normalize(filename: str): str</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id481583670340107" class="paragraph" dir="auto"><span class="emph">filename</span>: a string representing a valid path name. The file or directory represented by this argument may not exist.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
FSO.FileNaming = "URL"
' file:///home/user/Documents
normPath = FSO.Normalize("file:///home/user/Documents/")
' file:///home/user/Documents
normPath = FSO.Normalize("file:///home//user//Documents/")
' file:///home/user
normPath = FSO.Normalize("file:///home//user//Documents/../")
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
fs.FileNaming = "URL"
normPath = fs.Normalize("file:///home/user/Documents/")
normPath = fs.Normalize("file:///home//user//Documents/")
normPath = fs.Normalize("file:///home//user//Documents/../")
</code></pre></div>
<a id="OpenTextFile"></a>
<a id="bm_id531585320922937"></a>
<meta itemprop="keywords" content="FolderSystem service,OpenTextFile">
<h2 id="hd_id481585320922643" dir="auto">OpenTextFile</h2>
<p id="par_id121585320922117" class="paragraph" dir="auto">Opens a file and returns a <span class="literal">TextStream</span> object that can be used to read from, write to, or append to the file.</p>
<p id="par_id591613073104711" class="paragraph" dir="auto">Observe que el método no comprueba que el archivo indicado realmente sea de texto.</p>
<p id="par_id951613073135036" class="paragraph" dir="auto">El método devuelve un objeto <span class="literal">Null</span> (en BASIC) o <span class="literal">None</span> (en Python) si ha ocurrido un error.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id21626214460569" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.OpenTextFile(filename: str, iomode: int = 1, create: bool = False, encoding: str = 'UTF-8'): svc</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id551585320922678" class="paragraph" dir="auto"><span class="emph">filename</span>: Identifies the file to open.</p>
<p id="par_id671585320922388" class="paragraph" dir="auto"><span class="emph">iomode</span>: Indicates the input/output mode. It can be one of three constants: <span class="literal">svc.ForReading</span> (default), <span class="literal">svc.ForWriting</span>, or <span class="literal">svc.ForAppending</span>.</p>
<p id="par_id21585321398586" class="paragraph" dir="auto"><span class="emph">create</span>: Boolean value that indicates whether a new file can be created if the specified <span class="literal">filename</span> doesn't exist:</p>
<ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id721613073434797" class="listitem" dir="auto">If <span class="literal">True</span> a new file and its parent folders will be created if they do not exist;</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id201613073469289" class="listitem" dir="auto">If <span class="literal">False</span> then new files are not created (default).</p>
</li>
</ul>
<p id="par_id771585321576210" class="paragraph" dir="auto"><span class="emph">encoding</span>: The character set to be used. The default encoding is "UTF-8".</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
Dim myFile As Object
FSO.FileNaming = "SYS"
Set myFile = FSO.OpenTextFile("C:\Temp\ThisFile.txt", FSO.ForReading)
If Not IsNull(myFile) Then
' ...
End If
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
fs.FileNaming = "SYS"
myFile = fs.OpenTextFile(r"C:\Temp\ThisFile.txt", fs.ForReading)
if myFile is not None:
# ...
</code></pre></div>
<a id="PickFile"></a>
<a id="bm_id1001583670342501"></a>
<meta itemprop="keywords" content="FileSystem service,PickFile">
<h2 id="hd_id421583670342501" dir="auto">PickFile</h2>
<p id="par_id871583670342501" class="paragraph" dir="auto">Abre un cuadro de diálogo para abrir o guardar archivos.</p>
<p id="par_id881613074436979" class="paragraph" dir="auto">If the <span class="literal">SAVE</span> mode is set and the picked file exists, a warning message will be displayed.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id751626214688263" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.PickFile(defaultfile: str ='', mode: str = 'OPEN', filter: str = ''): str</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id481583670342502" class="paragraph" dir="auto"><span class="emph">defaultfile</span>: This argument is a string composed of a folder and file name:</p>
<ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id511613074665951" class="listitem" dir="auto">The folder part indicates the folder that will be shown when the dialog opens (default = the last selected folder).</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id631613074685308" class="listitem" dir="auto">La parte del archivo designa el archivo predeterminado que se abrirá o guardará.</p>
</li>
</ul>
<p id="par_id981583670342502" class="paragraph" dir="auto"><span class="emph">mode</span>: A string value that can be either "OPEN" (for input files) or "SAVE" (for output files). The default value is "OPEN".</p>
<p id="par_id31583670342502" class="paragraph" dir="auto"><span class="emph">filter</span>: The extension of the files displayed when the dialog is opened (default = no filter).</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<p id="par_id881626276134300" class="paragraph" dir="auto">The examples below open a file picker with the "txt" filter applied.</p>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
' Basic
aFile = FSO.PickFile("C:\Documents", "OPEN", "txt")
</code></pre></div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
# Python
aFile = fs.PickFile(r"C:\Documents", "OPEN", "txt")
</code></pre></div>
<a id="PickFolder"></a>
<a id="bm_id171583671701309"></a>
<meta itemprop="keywords" content="FileSystem service,PickFolder">
<h2 id="hd_id581583671701385" dir="auto">PickFolder</h2>
<p id="par_id521583671701777" class="paragraph" dir="auto">Abre un cuadro de diálogo para seleccionar una carpeta.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id671626215115555" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.PickFolder(defaultfolder: str = '', freetext: str = ''): str</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id951583671701872" class="paragraph" dir="auto"><span class="emph">defaultfolder</span>: A string containing the folder name that will be displayed when the dialog is opened (default = the last selected folder).</p>
<p id="par_id821583671701764" class="paragraph" dir="auto"><span class="emph">freetext</span>: Text to display in the dialog (default = "").</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
' Basic
aFolder = FSO.PickFolder("C:\Documents", "Choose a folder or press Cancel")
</code></pre></div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
# Python
aFolder = fs.PickFolder(r"C:\Documents", "Choose a folder or press Cancel")
</code></pre></div>
<a id="SubFolders"></a>
<a id="bm_id901584016761417"></a>
<meta itemprop="keywords" content="FileSystem service,Files">
<h2 id="hd_id51584016761775" dir="auto">SubFolders</h2>
<p id="par_id431584016761996" class="paragraph" dir="auto">Returns a zero-based array of strings corresponding to the folders stored in a given <span class="literal">foldername</span>.</p>
<p id="par_id431613075267241" class="paragraph" dir="auto">La lista puede filtrarse por medio de comodines.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id531626215218570" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.SubFolders(foldername: str, filter: str = '', includesubfolders: bool = False): str[0..*]</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id701584016761945" class="paragraph" dir="auto"><span class="emph">foldername</span>: A string representing a folder. The folder must exist. <span class="literal">foldername</span> must not designate a file.</p>
<p id="par_id471585648674921" class="paragraph" dir="auto"><span class="emph">filter</span>: A string containing wildcards ("?" and "*") that will be applied to the resulting list of folders (default = "").</p>
<p id="par_id731583944548857" class="paragraph" dir="auto"><span class="emph">includesubfolders</span>: Set this argument to <span class="literal">True</span> to include the contents of subfolders (Default = <span class="literal">False</span>).</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
Dim folderList As Variant, folder As String
FSO.FileNaming = "SYS"
folderList = FSO.SubFolders("/home/user/")
For Each folder In folderList
' ...
Next folder
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
fs.FileNaming = "SYS"
folderList = fs.SubFolders("/home/user/")
for folder in folderList:
# ...
</code></pre></div>
<div class="embedded">
<a id="SF_InternalUse"></a>
<div class="warning">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/warning.svg" alt="warning" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id851506659675843" dir="auto">Todas las rutinas o identificadores BASIC de <span class="literal">ScriptForge</span> precedidas por guion bajo «_» están reservadas para uso interno. No deben utilizarse en macros BASIC o secuencias Python.</p></div>
</div>
<br>
</div>
<a id="relatedtopics"></a><div class="relatedtopics">
<p class="related" itemprop="mentions" dir="auto"><a id="related"></a><span class="emph">Temas relacionados</span></p>
<div class="relatedbody" itemprop="mentions">
<div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/shared/03/sf_textstream.html">Servicio <span class="literal">ScriptForge</span>.<span class="literal">TextStream</span></a></p></div>
<div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/shared/03160000.html">Input Function [VBA]</a></p></div>
<div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/shared/03020103.html">Open Statement</a></p></div>
</div>
</div>
</div>
<div id="DonationFrame"></div>
<footer><h2 style="text-align: center;"><a href="https://books.libreoffice.org" target="_blank">Libros de LibreOffice</a></h2>
<div class="noteicon" dir="auto" style="display:flex;justify-content:center;flex-wrap:wrap;row-gap:15px;">
<img src="media/navigation/libo-writer.svg" alt="Writer Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-calc.svg" alt="Calc Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-impress.svg" alt="Impress Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-draw.svg" alt="Draw Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-base.svg" alt="Base Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-math.svg" alt="Math Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-symbol-black.svg" alt="Getting Started Icon" style="width:60px;height:60px;">
</div>
<div id="DEBUG" class="debug">
<h3 class="bug">Help content debug info:</h3>
<p dir="auto">This page is: <a href="https://opengrok.libreoffice.org/xref/help/source/text/sbasic/shared/03/sf_filesystem.xhp" target="_blank">/text/sbasic/shared/03/sf_filesystem.xhp</a></p>
<p dir="auto">Title is: Servicio ScriptForge.FileSystem</p>
<p id="bm_module" dir="auto"></p>
<p id="bm_system" dir="auto"></p>
<p id="bm_HID" dir="auto"></p>
</div></footer>
</body>
</html>