Skip to main content

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:

  1. Fork this repository.
  2. Create a new branch (e.g., feature-new-functionality).
  3. 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

SimpleFileEdit-0.3.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

SimpleFileEdit-0.3.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file SimpleFileEdit-0.3.0.tar.gz.

File metadata

  • Download URL: SimpleFileEdit-0.3.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for SimpleFileEdit-0.3.0.tar.gz
Algorithm Hash digest
SHA256 36926c8bb5e0a235c90be3ca07ad1424e0c2dbc4e9b17bf8770c8cfa5f3abb5a
MD5 ba6e740cb83e9e98e854e6d5f16361ed
BLAKE2b-256 f33b29d6f685452eeef61b19e8a3b2966a6921556075a6533ce9c0c47b6c7203

See more details on using hashes here.

File details

Details for the file SimpleFileEdit-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for SimpleFileEdit-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 144046aeb7c2dc5b7d28bcc19b5ca72013b51f660c69fb3882dc0cc60c97d617
MD5 3038b4b874fb9f77f94858acb1051658
BLAKE2b-256 fe054488529bd353027dd23a6d562d3e20fd7e2e71ade9b5acd04619ea594dcd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page