How can I find all subfolders containing a given file?For example, in a Minecraft server installation, the different worlds are stored in subfolders with arbitrary names. To identify that a given folder represents a world, I have to look for a level.dat inside it. Is there a command that finds all level.dat files and returns the folders that contain them?
Find folders containing a file
find
Simply find your file and return the dirname:find -name 'level.dat' -exec dirname {} \;