This article mainly introduces linux Shell to obtain the names of all folders in a directory. Friends who need it can refer to
to view all files under the directory:
#!/bin/bash cd /目标目录 for file in $(ls *) do echo $file done
Extension method, view all directories under the directory
#!/bin/bash cd /export/bak/original_document for dir in $(ls split*) do [ -d $dir ] && echo $dir #先判断是否是目录,然后再输出 done
The above is the detailed content of Detailed explanation of how to obtain the names of all folders in a certain directory using Shell under Linux. For more information, please follow other related articles on the PHP Chinese website!