osManag(Operating System Management) is a Python library for managing files and folders easily and quickly. The library includes multiple functions for creating, reading, writing, and deleting files and folders, as well as changing directories and listing directory contents.
Here’s a description of each function in the osManang module:
-
touch(File_Name)- Description: Creates an empty file if it does not already exist.
- Usage:
#Examples 1: osManang.touch('filename.txt') #Examples 2: File = osManang.touch('filename.txt') print(File)
-
cat(File_Name)- Description: Reads and returns the contents of the specified file.
- Usage:
#Examples 1: content = osManang.cat('filename.txt') print(content)
-
nano(File_Name, Mode, Write)- Description: Writes content to a file. The mode can be 'w' (write) or 'a' (append).
- Usage:
#Examples 1: osManang.nano('filename.txt', 'w', 'Hello, World!') #Examples 2: File = osManang.nano('filename.txt', 'w', 'Hello, World!') print(File)
-
rm(File_Name)- Description: Deletes the specified file.
- Usage:
#Examples 1: osManang.rm('filename.txt') #Examples 2: File = osManang.rm('filename.txt') print(File)
-
mkdir(Folder_Name)- Description: Creates a new folder if it does not already exist.
- Usage:
#Examples 1: osManang.mkdir('foldername') #Examples 2: File = osManang.mkdir('foldername') print(File)
-
rmdir(Folder_Name)- Description: Deletes the specified folder.
- Usage:
#Examples 1: osManang.rmdir('foldername') #Examples 2: File = osManang.rmdir('foldername') print(File)
-
ren(Name, New_Name)- Description: Renames a file or folder from
NametoNew_Name. - Usage:
#Examples 1: osManang.ren('oldname', 'newname') #Examples 2: File = osManang.ren('oldname', 'newname') print(File)
- Description: Renames a file or folder from
-
mv(source_path, destination_path)- Description: Moves a file or folder from
source_pathtodestination_path. - Usage:
#Examples 1: osManang.mv('source_path', 'destination_path') #Examples 2: File = osManang.mv('source_path', 'destination_path') print(File)
- Description: Moves a file or folder from
-
cd(path)- Description: Changes the current working directory to the specified
path. - Usage:
#Examples 1: osManang.cd('path') #Examples 2: path = osManang.cd('path') print(path)
- Description: Changes the current working directory to the specified
-
tree(chomain)- Description: Returns a tree-like structure of the directory at
chomain. - Usage:
#Examples 1: structure = osManang.tree('path') print(structure)
- Description: Returns a tree-like structure of the directory at
-
pwd()- Description: Returns the current working directory.
- Usage:
#Examples 1: cwd = osManang.pwd() print(cwd)
-
ls(path)- Description: Lists the contents of the directory at
path. - Usage:
#Examples 1: contents = osManang.ls('path') print(contents)
- Description: Lists the contents of the directory at
-
ls_l(path)- Description: Lists the contents of the directory at
pathwith details such as size and last modified time. - Usage:
#Examples 1: details = osManang.ls_l('path') print(details)
- Description: Lists the contents of the directory at
-
istime(path_Name)- Description: Returns the last access time of the specified file.
- Usage:
#Examples 1: last_access = osManang.istime('filename.txt') print(last_access)
-
size(path_Name)- Description: Returns the size of the specified file.
- Usage:
#Examples 1: file_size = osManang.size('filename.txt') print(file_size)
-
get_info()- Description: Returns a string containing environment variables and their values.
- Usage:
#Examples 1: info = osManang.get_info() print(info)
-
get_path()- Description: Returns a string containing executable paths.
- Usage:
#Examples 1: exec_paths = osManang.get_path() print(exec_paths)
This module provides a comprehensive set of file and directory management tools suitable for various tasks involving filesystem operations.