I am trying to use the find command to do the following:Delete a whole folder with files, folders and subfolders except for 2 files, here is an example of what I need: test/folder1/file1.txt test/folder1/file2.txt test/folder1/subfolder1/ test/folder1/subfolder1/file3.txt test/folder1/subfolder1/subfolder2/file4.txt test/folder2/file5.txt test/folder3/file6.txtI need to delete everything except for file2.txt and file3.txtHere is what I already did find /test* ! -path '/test/folder1/file2.txt' -a ! -path 'test/folder1/subfolder1/file3.txt'This will list me all the files except the ones I specified. However if I add -exec rm -rf {} by the end of the command it will delete everything.I have also tried this other command and didn't workrm -r  test/folder1/ !(file2.txt|file3.txt)I don't know much about regular expression so I am trying to make it work by testing commands I found online, however none of them seems to be working.
find: delete folder and sub folders but add exception to two files
linux;files;find