Modifications

Sauter à la navigation Sauter à la recherche
Ligne 24 : Ligne 24 :     
== Lire des fichiers depuis la carte ==
 
== Lire des fichiers depuis la carte ==
{{traduction}}
+
The '''get''' command can read and copy files from a MicroPython board to your computer.
    +
For example to print the contents of '''/boot.py''' from a board run the following command:
 +
 +
<nowiki>ampy --port /serial/port get boot.py</nowiki>
 +
 +
{{ADFImage|FEATHER-CHARGER-FICHIER-MICROPYTHON-FILEOP-30.png}}
 +
 +
This will print out the contents of '''boot.py''' from the board's root directory.
 +
 +
You can instead copy the contents of '''boot.py''' into a file on your computer by specifying the path to the file to save as a second argument.  For example to copy '''/boot.py''' from a board to a file '''board_boot.py''' on your computer you can run:
 +
 +
<nowiki>ampy --port /serial/port get boot.py board_boot.py</nowiki>
 +
 +
{{ADFImage|FEATHER-CHARGER-FICHIER-MICROPYTHON-FILEOP-31.png}}
 +
 +
{{ambox-stop|text= The get command will always overwrite files on the computer without warning!}}
 +
 +
== Créer des répertoire ==
 +
You can create hierarchies of folders on the MicroPython board's filesystem with the '''mkdir''' command.
 +
 +
For example to create a '''/foo''' folder under the root of a board run the following command:
 +
 +
<nowiki>ampy --port /serial/port mkdir foo</nowiki>
 +
 +
You can create directories inside directories too, for example to create a folder '''bar''' inside the foo folder above you can run:
 +
 +
<nowiki>ampy --port /serial/port mkdir /foo/bar</nowiki>
 +
 +
'''Make sure the parent foo directory exists before trying to create the bar subdirectory inside of it!''' The mkdir command won't create parent directories that don't exist.
 +
 +
== Lister les répertoires ==
 +
You can list the file and folder contents of a directory with the '''ls''' command.
 +
 +
If you don't specify any argument to the ls command then the contents of the MicroPython board's root will be listed.  However if you'd like to list the contents of a different directory just specify its path on the board as an argument.
 +
 +
For example to list the root contents of a board run:
 +
 +
<nowiki>ampy --port /serial/port ls</nowiki>
 +
 +
{{ADFImage|FEATHER-CHARGER-FICHIER-MICROPYTHON-FILEOP-32.png}}
 +
 +
Or to list the contents of a subfolder '''foo''' run:
 +
 +
<nowiki>ampy --port /serial/port ls /foo</nowiki>
 +
 +
== Effacer des fichiers et répertoires ==
 +
The '''rm''' command can remove a file or directory from a MicroPython board's filesystem.  To use the command just specify as an argument the path to the file or directory on the board to delete.  Note that directories must be empty before they can be deleted!
 +
 +
For example to delete a file '''test.py''' in the root of a board run the following commmand:
 +
 +
<nowiki>ampy --port /serial/port rm test.py</nowiki>
 +
 +
Or to delete a folder '''/foo/bar''', assuming it's empty, run the following command:
 +
 +
<nowiki>ampy --port /serial/port rm /foo/bar</nowiki>
 +
 +
{{ambox-stop|text=The rm command will delete files and folders without warning or asking to confirm!}}
    
{{FEATHER-CHARGER-FICHIER-MICROPYTHON-TRAILER}}
 
{{FEATHER-CHARGER-FICHIER-MICROPYTHON-TRAILER}}
29 918

modifications

Menu de navigation