Certainly! Here’s a complete solution for your Laracasts Filament v4 upgrade script question:
Yes, it's normal behavior for the Filament v4 upgrade script to leave behind the old, empty folders after it has migrated your resource files to the new directory structure.
The upgrade script’s responsibility is moving (or copying) the files to their new locations—it does not automatically delete directories that end up empty, as deleting folders could introduce a risk if any files had been missed or custom files existed. This is a precaution to help prevent accidental data loss.
It is safe to delete these empty folders as long as you confirm they are indeed empty and that all your resources are working as expected after the upgrade.
Recommended Steps:
- Thoroughly test your application after the upgrade to ensure all resources work as expected.
- Once you’ve confirmed everything is working, you can safely delete the old, empty directories.
If you want to automate the cleanup, you can run a command to remove all empty folders recursively from your app/Filament/Resources directory. Here’s an example (run from the root of your Laravel project):
For most UNIX/Linux/macOS systems:
find app/Filament/Resources -type d -empty -delete
Always review the directories about to be deleted before executing such a command, especially if you have customizations.
In summary:
Yes, it’s the default behavior for the upgrade to leave empty folders, and it’s safe to remove them once you confirm they are empty. This is a common clean-up step after restructuring directories.