Skip to main content

A Python module for file and directory operations

Project description

File Manager Module (FileTo_Tools)

A Python module for easy file and directory operations, including creation, reading, writing, and GUI-based file selection.


Installation

pip install FileTo_Tools

Features

✅ Create files and directories
✅ Read and write files with line-level control
✅ Save and close files safely
✅ Open file/folder dialogs (GUI)
✅ Supports with statements for clean resource handling


Usage

1. Creating Files & Directories

import FileTo_Tools

# Create a file (current directory)
FileTo_Tools.new.file("test.txt")

# Create a file (custom directory)
FileTo_Tools.new.file("data.txt", "C:/Users/Username/Documents")

# Create a directory
FileTo_Tools.new.dir("my_folder")

2. Opening & Editing Files

# Open a file (assign to variable 'file1')
file = FileTo_Tools.open("example.txt", "file1")

# Write content (appends to line 1)
FileTo_Tools.write("Hello, World!", 1, "file1")

# Save changes
FileTo_Tools.save("file1")

# Close the file
FileTo_Tools.close("file1")

# Using 'with' statement (auto-closes)
with FileTo_Tools.open("example.txt", "file2") as f:
    FileTo_Tools.write("New line", 2, "file2")
    FileTo_Tools.save("file2")

3. File & Folder Selection Dialogs

# Open a folder dialog (assign to 'folder1')
folder = FileTo_Tools.look.dir("folder1")
print(f"Selected folder: {folder.file_path}")

# Open a file dialog (assign to 'file3')
selected_file = FileTo_Tools.look.file("file3")
print(f"Selected file: {selected_file.file_path}")

# Using 'with' statement
with FileTo_Tools.look.file("file4") as f:
    print(f"Opened file: {f.file_path}")

API Reference

Function Description
FileTo_Tools.new.file(name, dir=None) Creates a new file (dir optional)
FileTo_Tools.new.dir(name, dir=None) Creates a new directory (dir optional)
FileTo_Tools.open(filename, var_name, dir=None) Opens a file and assigns it to var_name
FileTo_Tools.write(content, line, var_name) Writes content to line in file var_name
FileTo_Tools.save(var_name) Saves changes to file var_name
FileTo_Tools.close(var_name) Closes file var_name
FileTo_Tools.look.dir(var_name) Opens a folder dialog and assigns path to var_name
FileTo_Tools.look.file(var_name) Opens a file dialog and assigns path to var_name

Requirements

  • Python 3.6+
  • tkinter (usually included in Python standard library)

License

MIT License. See LICENSE for details.


Contributing

Feel free to open issues or PRs on GitHub.


🚀 Happy coding! Let me know if you need any modifications.

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

fileto_tools-0.1.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fileto_tools-0.1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file fileto_tools-0.1.1.tar.gz.

File metadata

  • Download URL: fileto_tools-0.1.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for fileto_tools-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dca8971f1a6181bfde2f627fc4faf1ec54db4079bc30dc2edd10851e3871423b
MD5 bea1207c16cc646d203568a9ab9ba7f9
BLAKE2b-256 530a09c2f6e0237774e37b2cf8691c42987c29b6575b778bba7da69632f202ba

See more details on using hashes here.

File details

Details for the file fileto_tools-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: fileto_tools-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for fileto_tools-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 171df250f13126d080f8525f954706ecc5f2804239dec6ac46dbdc43ef420b32
MD5 9d58bd4470a1eab12c671eabc29c0d9d
BLAKE2b-256 a09c082a5b0623aa77e1160f1681b339058a523239237e9914287ee6b761d0e7

See more details on using hashes here.

Supported by

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