Develop a Python script that can automatically detect and group files of the same type from a given folder. The script should provide options to organize these files into separate folders based on their file extensions.
Features:
Detect files with the same extensions in a specified folder.
Provide an option to create separate folders for each file type.
Move files of the same type into their respective folders. (A separate option for this will be nice.)
Example Usage:
# Example usage of the grouping script
import file_grouper
# Specify the folder path
folder_path = "/path/to/folder"
# Group files by extension
file_grouper.group_files_by_extension(folder_path)
Difficulty: Beginner
Tags: Python, File Handling, Scripting
Additional Information:
Consider using the os module for file operations and the shutil module for moving files.
Objective:
Develop a Python script that can automatically detect and group files of the same type from a given folder. The script should provide options to organize these files into separate folders based on their file extensions.
Features:
Example Usage:
Difficulty
: BeginnerTags
: Python, File Handling, ScriptingAdditional Information:
os
module for file operations and theshutil
module for moving files.Contribution Guidelines
The updated guidelines can be found here.
Note:
folder_name
: file_grouperscript_name
: file_grouper