Skip to main content

My short description for my project.

Project description

File to Folder

中文文档点我

This simple Python script, file_to_folder.py, is designed to organize files by moving them into folders based on their names. It can be useful for maintaining a clean and structured file system. The script works for both single files and entire directories.

Usage

  1. Clone the Repository:

    git clone https://github.com/your-username/file-to-folder-organizer.git
    
  2. Navigate to the Project Directory:

    cd file-to-folder-organizer
    
  3. Run the Script:

    python file_to_folder.py
    

    Follow the on-screen instructions to input the file or folder path.

How it Works

  • If the input is a single file, the script extracts the file name (excluding the extension) and checks if it matches the immediate parent folder's name. If not, it creates a new folder with the file name and moves the file into it.

  • If the input is a directory, the script recursively goes through all files and subdirectories. For each file, it follows the same logic as for a single file.

Example

Suppose you have a file named example.txt in a folder named Documents. Running the script on this file will create a new folder named example and move the file into it. The resulting structure will look like this:

- Documents
  - example
    - example.txt

Note

  • The script does not overwrite existing files. If a folder with the same name already exists, it will append a number to the folder's name to avoid conflicts.

  • Be cautious when using this script, especially on important directories, as it involves moving and potentially restructuring files.

Feel free to use, modify, and distribute this script according to your needs. If you encounter any issues or have suggestions for improvement, please open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

   

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

file_to_folder-0.0.0.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

file_to_folder-0.0.0.1-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file file_to_folder-0.0.0.1.tar.gz.

File metadata

  • Download URL: file_to_folder-0.0.0.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for file_to_folder-0.0.0.1.tar.gz
Algorithm Hash digest
SHA256 fd7ce8ff7f9133e1fded1c5f42207ef6297eed9b7db228b690b595dc8bf70dd0
MD5 aa5aab4fcb5c59019c760492c786d5f5
BLAKE2b-256 a9e4638cdcd7130faa7514aa725bf06afaa587c2c05c856102a08edbf6fc42d2

See more details on using hashes here.

File details

Details for the file file_to_folder-0.0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for file_to_folder-0.0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1ab93e1c3b92fe3e838af6c07175c1db8ad1f3f4261a2b00b9a6d0132943fecd
MD5 1025ef230655961fbad77cf33b848fb8
BLAKE2b-256 1ca726386eac7b40f87846b6ba0fb53194bc0566765269db08171de1f875ac04

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