| Name | FileMa JSON |
| Version |
0.1.5
JSON |
| download |
| home_page | https://github.com/ZOUITANE-Ahmed/FileMa.git |
| Summary | The `FileMa` (File Management) library provides utilities for file and directory management in Python. It includes functions for creating, removing, renaming, copying files and directories, as well as reading file contents, printing directory structures, and more. The library uses colored terminal output for better visual feedback. |
| upload_time | 2024-08-26 00:23:55 |
| maintainer | None |
| docs_url | None |
| author | Ahmed ZOUITANE |
| requires_python | >=3.6 |
| license | None |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# FileMa Library
## Overview
The `FileMa` library provides utilities for file and directory management in Python. It includes functions for creating, removing, renaming, copying files and directories, as well as reading file contents, printing directory structures, and more. The library uses colored terminal output for better visual feedback.
## Installation
Ensure that you have the `colorama` library installed. You can install it via pip if it's not already installed:
```bash
pip install colorama
```
## Installation FileMa Library
```bash
pip install FileMa
```
## Usage
Below are the available functions and how to use them.
### File Management
### Core Functions
1. **File Creation & Deletion**
- `touch(file_name)`: Create a new file or update the access time if it already exists.
- `rm(file_name)`: Remove a file if it exists.
2. **File Reading & Writing**
- `nano(file_name, mode, content)`: Write or append content to a file.
- `cat(file_name)`: Read and display the contents of a file.
3. **File Operations**
- `ren(name, new_name)`: Rename a file or directory.
- `mv(source_path, destination_path)`: Move a file or directory to a new location.
- `copy(file_name, new_file, mode)`: Copy contents from one file to another with the specified mode.
- `copyf(source_path, destination_path)`: Copy a file from the source to the destination path.
4. **Directory Management**
- `mkdir(folder_name)`: Create a new directory if it doesn't already exist.
- `rmdir(folder_name)`: Remove an empty directory.
- `mkdirs(folder_name)`: Create directories, including intermediate ones.
- `rmdirs(directory_path)`: Remove directories recursively.
- `copyd(source_path, destination_path)`: Copy an entire directory with its contents.
5. **Directory Navigation & Listing**
- `cd(path)`: Change the current working directory.
- `tree(path, prefix="")`: Recursively print the directory tree structure.
- `pwd()`: Print the current working directory.
- `ls(path)`: List the contents of a directory, identifying files and directories.
- `ls_l(path)`: List the contents of a directory with detailed information (permissions, last modified time, size).
6. **File Metadata**
- `istime(path_name)`: Print the last access time of a file.
- `size(path_name)`: Print the size of a file.
7. **System Information**
- `get_info()`: Print environment variables and their values.
- `get_path()`: Print executable paths.
These functions offer a robust set of tools for file management operations, and they include error handling for common issues like file not found or permission errors.
## Usage
### Import the Library
```python
import FileMa
```
### Available Functions
Here is the usage guide for the `FileMa` library functions :
### 1. **Create or Update a File**:
```python
FileMa.touch('example.txt')
```
**Description:** Creates a new file named `example.txt` if it does not already exist. If it does exist, it updates the access time.
### 2. **Remove a File**:
```python
FileMa.rm('example.txt')
```
**Description:** Removes the file named `example.txt` if it exists.
### 3. **Write or Append to a File**:
```python
FileMa.nano('example.txt', 'w', 'Hello, World!')
```
**Description:** Writes 'Hello, World!' to `example.txt`. Use `'a'` instead of `'w'` to append the content instead of overwriting it.
### 4. **Read a File**:
```python
FileMa.cat('example.txt')
```
**Description:** Displays the contents of `example.txt`.
### 5. **Rename a File or Directory**:
```python
FileMa.ren('old_name.txt', 'new_name.txt')
```
**Description:** Renames `old_name.txt` to `new_name.txt`.
### 6. **Move a File or Directory**:
```python
FileMa.mv('source_path.txt', 'destination_path.txt')
```
**Description:** Moves `source_path.txt` to `destination_path.txt`.
### 7. **Copy Content Between Files**:
```python
FileMa.copy('source.txt', 'destination.txt', 'w')
```
**Description:** Copies the content of `source.txt` to `destination.txt`. You can use `'a'` instead of `'w'` to append the content.
### 8. **Copy a File**:
```python
FileMa.copyf('source.txt', 'destination.txt')
```
**Description:** Copies the file `source.txt` to `destination.txt`.
### 9. **Create a Directory**:
```python
FileMa.mkdir('new_folder')
```
**Description:** Creates a new directory named `new_folder`.
### 10. **Remove an Empty Directory**:
```python
FileMa.rmdir('new_folder')
```
**Description:** Removes the empty directory named `new_folder`.
### 11. **Copy a Directory**:
```python
FileMa.copyd('source_folder', 'destination_folder')
```
**Description:** Copies `source_folder` and all its contents to `destination_folder`.
### 12. **Create Multiple Directories**:
```python
FileMa.mkdirs('parent_folder/child_folder')
```
**Description:** Creates `parent_folder` and `child_folder`, including any necessary intermediate directories.
### 13. **Remove Directories Recursively**:
```python
FileMa.rmdirs('folder_to_remove')
```
**Description:** Removes `folder_to_remove` and all its contents.
### 14. **Change the Current Directory**:
```python
FileMa.cd('path_to_directory')
```
**Description:** Changes the current working directory to `path_to_directory`.
### 15. **Print Directory Tree Structure**:
```python
FileMa.tree('path_to_directory')
```
**Description:** Prints the directory structure starting from `path_to_directory` in a hierarchical format.
### 16. **Print Current Working Directory**:
```python
FileMa.pwd()
```
**Description:** Prints the current working directory.
### 17. **List Directory Contents**:
```python
FileMa.ls('path_to_directory')
```
**Description:** Lists the contents of `path_to_directory`, indicating whether each item is a file or a directory.
### 18. **List Directory Contents with Details**:
```python
FileMa.ls_l('path_to_directory')
```
**Description:** Lists the contents of `path_to_directory` with detailed information, such as permissions, last modification time, and size.
### 19. **Get Last Access Time of a File**:
```python
FileMa.istime('file_name')
```
**Description:** Prints the last access time of the file `file_name`.
### 20. **Get File Size**:
```python
FileMa.size('file_name')
```
**Description:** Prints the size of the file `file_name` in bytes.
### 21. **Print Environment Variables**:
```python
FileMa.get_info()
```
**Description:** Prints all environment variables and their values.
### 22. **Print Executable Paths**:
```python
FileMa.get_path()
```
**Description:** Prints the paths where executables are searched for.
You can use these functions in your scripts to perform various file and directory operations effectively.
Raw data
{
"_id": null,
"home_page": "https://github.com/ZOUITANE-Ahmed/FileMa.git",
"name": "FileMa",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Ahmed ZOUITANE",
"author_email": "zouitane.ahmed02@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/b1/ff/439359f97fd7ce44dd387fb6c55ef21eb014610f641a414f30eb3393d4f1/filema-0.1.5.tar.gz",
"platform": null,
"description": "\r\n# FileMa Library\r\n\r\n## Overview\r\n\r\nThe `FileMa` library provides utilities for file and directory management in Python. It includes functions for creating, removing, renaming, copying files and directories, as well as reading file contents, printing directory structures, and more. The library uses colored terminal output for better visual feedback.\r\n\r\n## Installation\r\n\r\nEnsure that you have the `colorama` library installed. You can install it via pip if it's not already installed:\r\n\r\n```bash\r\npip install colorama\r\n```\r\n## Installation FileMa Library\r\n\r\n```bash\r\npip install FileMa\r\n```\r\n\r\n\r\n## Usage\r\n\r\nBelow are the available functions and how to use them.\r\n\r\n### File Management\r\n\r\n### Core Functions\r\n\r\n1. **File Creation & Deletion**\r\n - `touch(file_name)`: Create a new file or update the access time if it already exists.\r\n - `rm(file_name)`: Remove a file if it exists.\r\n\r\n2. **File Reading & Writing**\r\n - `nano(file_name, mode, content)`: Write or append content to a file.\r\n - `cat(file_name)`: Read and display the contents of a file.\r\n\r\n3. **File Operations**\r\n - `ren(name, new_name)`: Rename a file or directory.\r\n - `mv(source_path, destination_path)`: Move a file or directory to a new location.\r\n - `copy(file_name, new_file, mode)`: Copy contents from one file to another with the specified mode.\r\n - `copyf(source_path, destination_path)`: Copy a file from the source to the destination path.\r\n\r\n4. **Directory Management**\r\n - `mkdir(folder_name)`: Create a new directory if it doesn't already exist.\r\n - `rmdir(folder_name)`: Remove an empty directory.\r\n - `mkdirs(folder_name)`: Create directories, including intermediate ones.\r\n - `rmdirs(directory_path)`: Remove directories recursively.\r\n - `copyd(source_path, destination_path)`: Copy an entire directory with its contents.\r\n\r\n5. **Directory Navigation & Listing**\r\n - `cd(path)`: Change the current working directory.\r\n - `tree(path, prefix=\"\")`: Recursively print the directory tree structure.\r\n - `pwd()`: Print the current working directory.\r\n - `ls(path)`: List the contents of a directory, identifying files and directories.\r\n - `ls_l(path)`: List the contents of a directory with detailed information (permissions, last modified time, size).\r\n\r\n6. **File Metadata**\r\n - `istime(path_name)`: Print the last access time of a file.\r\n - `size(path_name)`: Print the size of a file.\r\n\r\n7. **System Information**\r\n - `get_info()`: Print environment variables and their values.\r\n - `get_path()`: Print executable paths.\r\n\r\n\r\nThese functions offer a robust set of tools for file management operations, and they include error handling for common issues like file not found or permission errors.\r\n\r\n\r\n## Usage\r\n\r\n### Import the Library\r\n\r\n```python\r\nimport FileMa\r\n```\r\n\r\n### Available Functions\r\n\r\nHere is the usage guide for the `FileMa` library functions :\r\n\r\n### 1. **Create or Update a File**:\r\n```python\r\nFileMa.touch('example.txt')\r\n```\r\n**Description:** Creates a new file named `example.txt` if it does not already exist. If it does exist, it updates the access time.\r\n\r\n### 2. **Remove a File**:\r\n```python\r\nFileMa.rm('example.txt')\r\n```\r\n**Description:** Removes the file named `example.txt` if it exists.\r\n\r\n### 3. **Write or Append to a File**:\r\n```python\r\nFileMa.nano('example.txt', 'w', 'Hello, World!')\r\n```\r\n**Description:** Writes 'Hello, World!' to `example.txt`. Use `'a'` instead of `'w'` to append the content instead of overwriting it.\r\n\r\n### 4. **Read a File**:\r\n```python\r\nFileMa.cat('example.txt')\r\n```\r\n**Description:** Displays the contents of `example.txt`.\r\n\r\n### 5. **Rename a File or Directory**:\r\n```python\r\nFileMa.ren('old_name.txt', 'new_name.txt')\r\n```\r\n**Description:** Renames `old_name.txt` to `new_name.txt`.\r\n\r\n### 6. **Move a File or Directory**:\r\n```python\r\nFileMa.mv('source_path.txt', 'destination_path.txt')\r\n```\r\n**Description:** Moves `source_path.txt` to `destination_path.txt`.\r\n\r\n### 7. **Copy Content Between Files**:\r\n```python\r\nFileMa.copy('source.txt', 'destination.txt', 'w')\r\n```\r\n**Description:** Copies the content of `source.txt` to `destination.txt`. You can use `'a'` instead of `'w'` to append the content.\r\n\r\n### 8. **Copy a File**:\r\n```python\r\nFileMa.copyf('source.txt', 'destination.txt')\r\n```\r\n**Description:** Copies the file `source.txt` to `destination.txt`.\r\n\r\n### 9. **Create a Directory**:\r\n```python\r\nFileMa.mkdir('new_folder')\r\n```\r\n**Description:** Creates a new directory named `new_folder`.\r\n\r\n### 10. **Remove an Empty Directory**:\r\n```python\r\nFileMa.rmdir('new_folder')\r\n```\r\n**Description:** Removes the empty directory named `new_folder`.\r\n\r\n### 11. **Copy a Directory**:\r\n```python\r\nFileMa.copyd('source_folder', 'destination_folder')\r\n```\r\n**Description:** Copies `source_folder` and all its contents to `destination_folder`.\r\n\r\n### 12. **Create Multiple Directories**:\r\n```python\r\nFileMa.mkdirs('parent_folder/child_folder')\r\n```\r\n**Description:** Creates `parent_folder` and `child_folder`, including any necessary intermediate directories.\r\n\r\n### 13. **Remove Directories Recursively**:\r\n```python\r\nFileMa.rmdirs('folder_to_remove')\r\n```\r\n**Description:** Removes `folder_to_remove` and all its contents.\r\n\r\n### 14. **Change the Current Directory**:\r\n```python\r\nFileMa.cd('path_to_directory')\r\n```\r\n**Description:** Changes the current working directory to `path_to_directory`.\r\n\r\n### 15. **Print Directory Tree Structure**:\r\n```python\r\nFileMa.tree('path_to_directory')\r\n```\r\n**Description:** Prints the directory structure starting from `path_to_directory` in a hierarchical format.\r\n\r\n### 16. **Print Current Working Directory**:\r\n```python\r\nFileMa.pwd()\r\n```\r\n**Description:** Prints the current working directory.\r\n\r\n### 17. **List Directory Contents**:\r\n```python\r\nFileMa.ls('path_to_directory')\r\n```\r\n**Description:** Lists the contents of `path_to_directory`, indicating whether each item is a file or a directory.\r\n\r\n### 18. **List Directory Contents with Details**:\r\n```python\r\nFileMa.ls_l('path_to_directory')\r\n```\r\n**Description:** Lists the contents of `path_to_directory` with detailed information, such as permissions, last modification time, and size.\r\n\r\n### 19. **Get Last Access Time of a File**:\r\n```python\r\nFileMa.istime('file_name')\r\n```\r\n**Description:** Prints the last access time of the file `file_name`.\r\n\r\n### 20. **Get File Size**:\r\n```python\r\nFileMa.size('file_name')\r\n```\r\n**Description:** Prints the size of the file `file_name` in bytes.\r\n\r\n### 21. **Print Environment Variables**:\r\n```python\r\nFileMa.get_info()\r\n```\r\n**Description:** Prints all environment variables and their values.\r\n\r\n### 22. **Print Executable Paths**:\r\n```python\r\nFileMa.get_path()\r\n```\r\n**Description:** Prints the paths where executables are searched for.\r\n\r\nYou can use these functions in your scripts to perform various file and directory operations effectively.\r\n",
"bugtrack_url": null,
"license": null,
"summary": "The `FileMa` (File Management) library provides utilities for file and directory management in Python. It includes functions for creating, removing, renaming, copying files and directories, as well as reading file contents, printing directory structures, and more. The library uses colored terminal output for better visual feedback.",
"version": "0.1.5",
"project_urls": {
"Homepage": "https://github.com/ZOUITANE-Ahmed/FileMa.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9df9c78acfb710df6a6537a74476bfa831522d4e08391ec9d787459566869028",
"md5": "f7c52914a03f02fceabc37627b3fce1a",
"sha256": "203d1400bf2ab44022f80af5deb66ba42e02d63f1b860b0373731b37e984d9c1"
},
"downloads": -1,
"filename": "FileMa-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f7c52914a03f02fceabc37627b3fce1a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 7195,
"upload_time": "2024-08-26T00:23:53",
"upload_time_iso_8601": "2024-08-26T00:23:53.341292Z",
"url": "https://files.pythonhosted.org/packages/9d/f9/c78acfb710df6a6537a74476bfa831522d4e08391ec9d787459566869028/FileMa-0.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b1ff439359f97fd7ce44dd387fb6c55ef21eb014610f641a414f30eb3393d4f1",
"md5": "5bb44212c88f0bf5f8caba376727912a",
"sha256": "7b49c34e2e82ec76f728fb4f8c41b03e3975f45b335f472e488f094709a89367"
},
"downloads": -1,
"filename": "filema-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "5bb44212c88f0bf5f8caba376727912a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 6845,
"upload_time": "2024-08-26T00:23:55",
"upload_time_iso_8601": "2024-08-26T00:23:55.119310Z",
"url": "https://files.pythonhosted.org/packages/b1/ff/439359f97fd7ce44dd387fb6c55ef21eb014610f641a414f30eb3393d4f1/filema-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-26 00:23:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ZOUITANE-Ahmed",
"github_project": "FileMa",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "filema"
}