Basically, I want to delete all subfolders, but leave all the files intact. For example:
Folder1/
randomStuff/
nope.txt
installer.jar
build.sh
I want randomStuff and its files deleted, but keep installer.jar and build.sh intact.
rm -r ./*/
,rm -r -- */
, orrm -r -- ./*/
please. – jesse_b Dec 28 '17 at 03:21rm -r */
, which, in an empty directory expands torm -r */
, which will give an error fromrm
since the file/directory*
doesn't exist. If there was a directory named-f
, it would be added to the command line as-f/
, which would probably give an error about an invalid option/
. Even withnullglob
set, the whole word would disappear, not just the asterisk, sorm
would still complain about a missing target. I can't see how that could target the user's home directory? – ilkkachu Dec 28 '17 at 11:08rm
is-r
, which was already given here. – ilkkachu Dec 28 '17 at 11:09