If the folder structure is:
parentFolder
├── file1.rtf
├── file2.rtf
├── moreFiles.rtf
├── subFolder1
└── subFolder2
How would I delete subFolder1
, but not subFolder2
or any of the files without specifying the file names? Specifying folder names is ok.
I know you could specify each folder and file not to be deleted:
rm -r !("file1.rtf"|"file2.rtf"|"subFolder1")
But I would prefer not to have name each file.