<|im_start|>system
You are a helpful AI assistant.<|im_end|>
<|im_start|>user
I need a Python script that can help me organize my Windows computer by sorting files by type from my desktop and putting them into the correct folder. The script should be able to scan my desktop and identify the type of each file based on its extension (e.g., .docx, .jpg, .pdf). Then, it should find the correct folder for each file type (e.g., 'Documents', 'Pictures', 'Videos') and move the corresponding files to the appropriate folder. Can you generate a script that meets these requirements?<|im_end|>
<|im_start|>assistant
Of course, here is a python script that moves your files from desktop to other folders according to the file extension:

```python
import os
from pathlib import Path
from shutil import move

home = Path(os.environ['USERPROFILE'])
src = home / "Desktop"  # assume English locale

# The mapping from file extensions to destination folders
ext_to_dst = {
    ".jpg":  home / "Pictures",
    ".docx": home / "Documents",
    ".pdf":  home / "Documents",
    ".mp4":  home / "Videos",
    # add more mappings here as needed
}

for f in src.rglob('*'):
    ext = f.suffix.lower()  # e.g. handle .JPG the same way as .jpg
    dst = ext_to_dst.get(ext)
    if dst:
        shutil.move(f, dst / f.name)
```<|im_end|>
<|im_start|>user
Thank you! The script works great!<|im_end|>
<|im_start|>assistant
Happy to help you. If you need any changes to the Python script, just ask.<|im_end|>