A tool that makes file and folder managing in python the simplest it can get!
Project description
SimpleFileEdit
SimpleFileEdit is a Python package designed to simplify file and folder operations. With this package, you can create, edit, and rename files and folders effortlessly.
Installation
To install the package (once published), use pip:
pip install SimpleFileEdit
Features
1. NewFile
Create a new file with a specified name, type, and location.
Arguments:
filename
(str): The name of the file (without extension).path
(str, optional): The directory path to create the file in. Defaults to the current working directory.filetype
(str, optional): The file extension/type. Defaults to "txt".
Example:
from SimpleFileEdit import NewFile
NewFile("hello world", filetype="json")
Creates "hello world.json" in the current working directory.
2. EditFile
Edit an existing file by adding new content or overwriting it.
Arguments:
filename
(str): The name of the file to edit (without extension).content
(str, optional): The content to write to the file. Defaults to a template message.filetype
(str, optional): The file extension/type. Defaults to "txt".path
(str, optional): The directory path of the file. Defaults to the current working directory.mode
(str, optional): The editing mode. Options are "add-to-end" or "overwrite". Defaults to "add-to-end".
Example:
from SimpleFileEdit import EditFile
EditFile("hello world", "Hello, World!", filetype="txt", path="/helloWorldFolder", mode="overwrite")
# Overwrites the content of "hello world.txt" in "/helloWorldFolder" with "Hello, World!".
3. EditFileName
Rename a file and optionally change its file type.
Arguments:
filename
(str): The current name of the file (without extension).filetype
(str, optional): The current file type. Defaults to "txt".newname
(str): The new name for the file (without extension).newfiletype
(str, optional): The new file type. Defaults to the current file type.path
(str, optional): The directory path of the file. Defaults to the current working directory.
Example:
from SimpleFileEdit import EditFileName
EditFileName("hello world", "txt", "HELLO-WORLD", newfiletype="md", path="/helloWorldFolder")
# Renames "hello world.txt" to "HELLO-WORLD.md" in "/helloWorldFolder".
4. NewFolder
Create a new folder in the specified location.
Arguments:
foldername
(str): The name of the folder to create.path
(str, optional): The directory path to create the folder in. Defaults to the current working directory.
Example:
from SimpleFileEdit import NewFolder
NewFolder("helloWorldFolder")
# Creates a folder named "helloWorldFolder" in the current working directory.
5. EditFolder
Rename an existing folder.
Arguments:
foldername
(str): The current name of the folder.newfoldername
(str): The new name for the folder.path
(str, optional): The directory path of the folder. Defaults to the current working directory.
Example:
from SimpleFileEdit import EditFolder
EditFolder("helloWorldFolder", "helloworldFOLDER")
# Renames "helloWorldFolder" to "helloworldFOLDER" in the current working directory.
Example Usage
Here’s a complete example of how to use SimpleFileEdit:
from SimpleFileEdit import NewFile, EditFile, EditFileName, NewFolder, EditFolder
# Create a new folder
NewFolder("exampleFolder")
# Create a new file in the folder
NewFile("example", path="./exampleFolder", filetype="txt")
# Edit the file's content
EditFile("example", "This is new content.", filetype="txt", path="./exampleFolder", mode="overwrite")
# Rename the file
EditFileName("example", "txt", "new_example", path="./exampleFolder")
# Rename the folder
EditFolder("exampleFolder", "newExampleFolder")
Future Features (Planned)
- File deletion functionality.
- Folder deletion functionality.
- Copying files and folders.
- Enhanced error handling and logging.
Contributing
Contributions are welcome! To contribute:
- Fork this repository.
- Create a new branch (e.g.,
feature-new-functionality
). - Submit a pull request with a detailed description of your changes.
License
This project is licensed under the MIT License.
Author
Developed by BravestCheetah. For questions, feedback, or feature requests, feel free to reach out.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file SimpleFileEdit-0.2.0.tar.gz
.
File metadata
- Download URL: SimpleFileEdit-0.2.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d342eb60db515ecf42657f9b357014bdf13f54fe9649c6b972864091c1a7a1c9 |
|
MD5 | a344123c893a8e7b177c1847d2dc6fe2 |
|
BLAKE2b-256 | 0e27bbee33fd10c0faf47f9ab1552917a907fbac22132197f8d4677e3d3e4101 |
File details
Details for the file SimpleFileEdit-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: SimpleFileEdit-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | faa2211bdd54114e6f0df9c897d2b1a107b752f5cbdf8e6ef45997575a36e825 |
|
MD5 | 642d9d99d59ba6197956278989a53c86 |
|
BLAKE2b-256 | ac4e92392f4c1c0b4554c247f564f8bbdd2e325c091fc248fed9a50ce133a2c8 |