Skip to content
Navinderjeet Singh edited this page Feb 2, 2025 · 2 revisions

Welcome to the betterfilesystem WIKI!

Here, you will learn to use the betterfilesysytem lib!

Installation

open the terminal, and paste the following command:

pip install betterfilesystem

Congrats! you have installed the betterfilesystem lib!

Useage

Create the main.py file and paste this code to access it:

from betterfilesystem import *

This will import the Library.

Functions

There are various Functions in the better filesystem lib like createfile, deletefile, readfile, editfile, move, create_dir and delete_dir.

The createfile function uses 2 parameters:

createfile(filename, filecontent)

This will create a file.

The deletefile function takes only 1 parameter: ```python```` deletefile(filepath)

this will delete the file.

The `readfile` function takes 1 parameter also:
```python
variable_name = readfile(filepath)

This will return the contents of the file.so, you need to store it in an variable Like mentioned above.

The editfile function takes 2 parameters:

editfile(filename, filecontent)

It appends the file or adds the content to a file. Here is an example code:

editfile("test.txt", "line1\n")
editfile("test.txt", "line2\n")

Output:

line1
line2

The move function takes 2 parameters:

move(currentpath, movedpath)

This will move a file.

The create_dir function takes 1 parameter:

create_dir(directory)

This will create a directory and also support the creation of Nested Directories.

The delete_dir function takes 2 parameters:

delete_dir(directory)

This will Delete a Directory or or Nested Directories.

Clone this wiki locally