The file_manager package is meant to edit and modify the user's local computer files. This includes creating directories and files. The package is very simple to use and understand as it has basic functions.
Download the folder and place it into your Python project, then use the following:
from file_manager import file_manager as files
Then use files.
before calling any function, here's an example:
from file_manager import file_manager as files
files.createFile(path)
- Creating, renaming, removing, cloning and moving files and directories
- Find the file size of files and directories
- Reading and writing in files
createFile(path)
, Creates a file in a specified directory. path is replaced with the desired pathremoveFile(path)
, Removes a file (Warning: Files skip the trash bin!). path is replaced with the desired pathrenameFile(path, name)
, Renames a file. path is replaced with the desired path, name is replaced with the desired namecopyFile(path, destination)
, Copies a file to another directory. path is replaced with the desired path, destination is replaced with the desired destinationmoveFile(path, destination)
, Moves a file to another directory. path is replaced with the desired path, destination is replaced with the desired destinationwriteFile(path, text, line = None, writeType = 'add')
, Writes in a text file. path is replaced with the desired path, text is replaced with any string, line (optional) defines where the text is written, writeType defines the way it writes (add
adds text at the bottom,insert
inserts text in the specified line,replace
replaces the specified line with text)readFile(path, line = None)
, Reads a text file. path is replaced with the desired path, line (optional) defines what line should be readclearLine(path, line)
, Clears a line in the specified text file. path is replaced with the desired path, line defines what line should be erasedclearFileContent(path)
, Clears a text file's content. path is replaced with the desired pathgetFileSize(path, formatted = False)
, Gives the file size of the specified file. path is replaced with the desired path, formatted (optional) formats the result (if formatted is set to True)findFile(path)
, Says if a file exists or not, path is replaced with the desired pathgetDirectory()
, Says the path of the current file (That ran the function)
createDirectory(path)
, Creates a directory. path is replaced with the desired pathremoveDirectory(path)
, Removes a directory and its contents (Warning: The directory will skip the trash bin!). path is replaced with the desired pathrenameDirectory(path, name)
, Renames a directory. path is replaced with the desired path, name is replaced with the desired namecopyDirectory(path, destination)
, Copies a directory to another directory. path is replaced with the desired path, destination is replaced with the desired destinationcopyDirectoryContent(path, destination)
, Copies a directory's content to another directory. path is replaced with the desired path, destination is replaced with the desired destinationgetDirectoryContent(path)
, Reads the content of a directory. path is replaced with the desired pathclearDirectoryContent(path, limit = 1000000)
, Clears the content of a directory. path is replaced with the desired path, limit (optional) defines the maximum amount of files that can be deletedcountFiles(file, path = '/')
, Counts the amount of files (with a specific name) in a directory. file is replaced with the file name, path (optional) defines the path for where to lookcountAllFiles()
, Counts the total amount of files in the user's computer
diskStorageUsed(formatted = False)
, Says the amount of storage used on the user's computer. formatted (optional) formats the result (if formatted is set to True)diskStorageFree(formatted = False)
, Says the amount of free storage on the user's computer. formatted (optional) formats the result (if formatted is set to True)diskStorageTotal(formatted = False)
, Says the total storage on the user's computer. formatted (optional) formats the result (if formatted is set to True)