DEV Community

Cover image for Linux Bash: To search an empty folder (easy script)
Sven Krämer
Sven Krämer

Posted on

Linux Bash: To search an empty folder (easy script)

This is a very easy script in the Linux Bash in order to find a folder. Here you can add your directory path and the max depth where the Bash should search.

#!/bin/bash

echo -n "Add the directory where to search "
read directorypath

echo -n "Add the searchdepth "
read searchdepth

find $directorypath -maxdepth $searchdepth -type d -empty 2>/dev/null
Enter fullscreen mode Exit fullscreen mode

Top comments (0)