In a sandboxed environment, locate every regular file starting from the current directory and delete them. Directories, and any non-regular entries (symlinks, devices) should not be removed. Hidden files (including dotfiles) must be included in the deletion.
Constraints: The operation should not delete directories or other non-file entries. Use portable POSIX-compatible tooling. Prefer handling spaces and special characters in filenames robustly (e.g., find ... -print0 with xargs -0).
Deliverables:
A one-line shell command that deletes all regular files from the current directory downward.
A self-contained script named delete_all_files.sh that performs the same operation safely, with a usage message and strict error handling.
A short safety note about running in a sandbox.
Example usage:
text
bash delete_all_files.sh
Notes:
Dotfiles are included in the deletion.
The command will not remove directories themselves. If directories are empty afterward, that is expected.
Do a dry run by listing first: find . -type f -print0 | xargs -0 -I{} echo rm -f "{}"