Copies a file or directory, possibly across filesystems.
dbutils.fs.cp("/FileStore/old_file.txt", "/tmp/new/new_file.txt")
Returns up to the specified maximum number bytes of the given file. The bytes are returned as a UTF-8 encoded string.
dbutils.fs.head("/tmp/my_file.txt", 25)
Lists the contents of a directory.
dbutils.fs.ls("/tmp")
Creates the given directory if it does not exist. Also creates any necessary parent directories.
dbutils.fs.mkdirs("/tmp/parent/child/grandchild")
Moves a file or directory, possibly across filesystems. A move is a copy followed by a delete, even for moves within filesystems.
dbutils.fs.mv("/FileStore/my_file.txt", "/tmp/parent/child/grandchild")
Writes the specified string to a file. The string is UTF-8 encoded.
dbutils.fs.put("/tmp/hello_db.txt", "Hello, Databricks!", True)
Removes a file or directory and optionally all of its contents. If a file is specified, the recurse parameter is ignored. If a directory is specified, an error occurs if recurse is disabled and the directory is not empty.
dbutils.fs.rm("/tmp", True)
Removes the widget with the specified programmatic name.
dbutils.widgets.removeAll()
No comments:
Post a Comment