このタイプのディレクトリ構造の場合:
/config/filegroups/filegroupA/files/fileA1.txt
/config/filegroups/filegroupA/files/fileA2.txt
/config/filegroups/filegroupB/files/fileB1.txt
/config/filegroups/filegroupB/files/fileB2.txt
...
rm -rf /config/filesgroups
親フォルダとすべてのサブフォルダを削除するために使用できることがわかります。
/filegroupA
しかし、削除するの/filegroupB
ではなく、などを削除したいと思います。/config/filegroups
ベストアンサー1
rm -rf /config/filegroups/*
ファイルを変更せずにディレクトリ(およびディレクトリへのシンボリックリンク)のみを削除したい場合は、/config/filegroups
後でスラッシュを使用できます。
rm -rf /config/filegroups/*/
名前がaで始まるディレクトリを削除するには、.
かなり新しいbashがあるとし、dotglobシェルオプションを使用する必要があります。
shopt -s dotglob
rm -rf /config/filegroups/*/
shopt -u dotglob