← All Notes
journal

Empty the Current Folder in Ubuntu

Deleting everything inside the current folder, including hidden files, while keeping the folder itself.

find . -mindepth 1 -delete
  • find . targets the current folder
  • -minddepth 1 prevents the folder itself from being deleted.
  • -delete removes all files and subfolders, including hidden files (.file, .folder/, etc).

Deletion is permanent.

Source: GNU Findutils manual