# eric7.MicroPython.MicroPythonFileManager

Module implementing some file system commands for MicroPython.

### Global Attributes

None

### Classes

MicroPythonFileManager | Class implementing an interface to the device file system commands with some additional sugar.

### Functions

None

## MicroPythonFileManager

Class implementing an interface to the device file system commands with some additional sugar.

### Signals

createDirectoryDone()
  emitted after a directory was created
currentDir(dirname)
  emitted to report the current directory of the device
currentDirChanged(dirname)
  emitted to report back a change of the current directory
deleteFileDone(deviceFile)
  emitted after the file has been deleted on the connected device
error(exc)
  emitted with a failure message to indicate a failure during the most recent operation
fsinfoDone(fsinfo)
  emitted after the file system information was obtained
getFileDone(deviceFile, localFile)
  emitted after the file was fetched from the connected device and written to the local file system
longListFiles(result)
  emitted with a tuple of tuples containing the name, mode, size and time for each directory entry
putFileDone(localFile, deviceFile)
  emitted after the file was copied to the connected device
removeDirectoryDone()
  emitted after a directory has been deleted
rsyncDone(localName, deviceName)
  emitted after the rsync operation has been completed
rsyncProgressMessage(msg)
  emitted to send a message about what rsync is doing

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

MicroPythonFileManager | Constructor
__rsync | Private method to synchronize a local directory to the device.
cd | Public slot to change the current directory of the device.
delete | Public slot to delete a file on the device.
fileSystemInfo | Public method to obtain information about the currently mounted file systems.
get | Public slot to get a file from the connected device.
lls | Public slot to get a long listing of the given directory.
mkdir | Public slot to create a new directory.
put | Public slot to put a file onto the device.
pwd | Public slot to get the current directory of the device.
rmdir | Public slot to (recursively) remove a directory.
rsync | Public slot to synchronize a local directory to the device.

### Static Methods

None

#### MicroPythonFileManager (Constructor)

MicroPythonFileManager(commandsInterface, parent=None)

Constructor

commandsInterface (MicroPythonCommandsInterface)
  reference to the commands interface object
parent (QObject)
  reference to the parent object

#### MicroPythonFileManager.__rsync

__rsync(hostDirectory, deviceDirectory, mirror=True, localDevice=False, indentLevel=0, )

Private method to synchronize a local directory to the device.

hostDirectory (str)
  name of the local directory
deviceDirectory (str)
  name of the directory on the device
mirror (bool)
  flag indicating to mirror the local directory to the device directory
localDevice (bool)
  flag indicating device access via local file system
indentLevel (int)
  indentation level for progress messages

Return:
  list of errors

Return Type:
  list of str

#### MicroPythonFileManager.cd

cd(dirname)

Public slot to change the current directory of the device.

dirname (str)
  name of the desired current directory

#### MicroPythonFileManager.delete

delete(deviceFileName)

Public slot to delete a file on the device.

deviceFileName (str)
  name of the file on the connected device

#### MicroPythonFileManager.fileSystemInfo

fileSystemInfo()

Public method to obtain information about the currently mounted file systems.

#### MicroPythonFileManager.get

get(deviceFileName, hostFileName="")

Public slot to get a file from the connected device.

deviceFileName (str)
  name of the file on the device
hostFileName (str)
  name of the local file

#### MicroPythonFileManager.lls

lls(dirname, showHidden=False)

Public slot to get a long listing of the given directory.

dirname (str)
  name of the directory to list
showHidden (bool)
  flag indicating to show hidden files as well

#### MicroPythonFileManager.mkdir

mkdir(dirname)

Public slot to create a new directory.

dirname (str)
  name of the directory to create

#### MicroPythonFileManager.put

put(hostFileName, deviceFileName="")

Public slot to put a file onto the device.

hostFileName (str)
  name of the local file
deviceFileName (str)
  name of the file on the connected device

#### MicroPythonFileManager.pwd

pwd()

Public slot to get the current directory of the device.

#### MicroPythonFileManager.rmdir

rmdir(dirname, recursive=False)

Public slot to (recursively) remove a directory.

dirname (str)
  name of the directory to be removed
recursive (bool)
  flag indicating a recursive removal

#### MicroPythonFileManager.rsync

rsync(hostDirectory, deviceDirectory, mirror=True, localDevice=False)

Public slot to synchronize a local directory to the device.

hostDirectory (str)
  name of the local directory
deviceDirectory (str)
  name of the directory on the device
mirror (bool)
  flag indicating to mirror the local directory to the device directory
localDevice (bool)
  flag indicating device access via local file system

Up