Kodi Documentation 18.0
Kodi is an open source media player and entertainment hub.
Library - xbmcvfs

Virtual file system functions on Kodi. More...

Modules

 File
 Kodi's file class.
 
 Stat
 Get file or file system status.
 

Functions

 copy (...)
 
 delete (...)
 Delete a file. More...
 
 rename (...)
 Rename a file. More...
 
 exists (...)
 Check for a file or folder existence. More...
 
 mkdir (...)
 
 mkdirs (...)
 
 rmdir (...)
 
 listdir (...)
 

Detailed Description

Virtual file system functions on Kodi.

Offers classes and functions offers access to the Virtual File Server (VFS) which you can use to manipulate files and folders.

Function Documentation

◆ copy()

copy (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> xbmcvfs.copy(source, destination) </big></font></span></code></h4> \endhtmlonly

Copy file to destination, returns true/false.

Parameters
sourcefile to copy.
destinationdestination file
Returns
True if successed

Example:

..
success = xbmcvfs.copy(source, destination)
..

◆ delete()

delete (   ...)

Delete a file.

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> xbmcvfs.delete(file) </big></font></span></code></h4> \endhtmlonly

Parameters
fileFile to delete
Returns
True if successed

Example:

..
xbmcvfs.delete(file)
..

◆ exists()

exists (   ...)

Check for a file or folder existence.

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> xbmcvfs.exists(path) </big></font></span></code></h4> \endhtmlonly

Parameters
pathFile or folder (folder must end with slash or backslash)
Returns
True if successed

Example:

..
success = xbmcvfs.exists(path)
..

◆ listdir()

listdir (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> xbmcvfs.listdir(path) </big></font></span></code></h4> \endhtmlonly

Lists content of a folder.

Parameters
pathFolder to get list from
Returns
Directory content list

Example:

..
dirs, files = xbmcvfs.listdir(path)
..

◆ mkdir()

mkdir (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> xbmcvfs.mkdir(path) </big></font></span></code></h4> \endhtmlonly

Create a folder.

Parameters
pathFolder to create
Returns
True if successed

Example:

..
success = xbmcvfs.mkdir(path)
..

◆ mkdirs()

mkdirs (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> xbmcvfs.mkdirs(path) </big></font></span></code></h4> \endhtmlonly

Make all directories along the path

Create folder(s) - it will create all folders in the path.

Parameters
pathFolders to create
Returns
True if successed

Example:

..
success = xbmcvfs.mkdirs(path)
..

◆ rename()

rename (   ...)

Rename a file.

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> xbmcvfs.rename(file, newFileName) </big></font></span></code></h4> \endhtmlonly

Parameters
fileFile to rename
newFileNameNew filename, including the full path
Returns
True if successed
Note
Moving files between different filesystem (eg. local to nfs://) is not possible on all platforms. You may have to do it manually by using the copy and deleteFile functions.

Example:

..
success = xbmcvfs.rename(file,newFileName)
..

◆ rmdir()

rmdir (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> xbmcvfs.rmdir(path) </big></font></span></code></h4> \endhtmlonly

Remove a folder.

Parameters
pathFolder to remove
Returns
True if successed

Example:

..
success = xbmcvfs.rmdir(path)
..