Session.RemoveFiles removes all files and subfolders matching the mask.
You most probably have no subfolder with ".txt" extension.
For any other custom matching, you need to iterate the files yourself (use
Session.RemoveFiles individually for each file you want to delete.
This makes no sense to me as 20-year developer with software that itself asks the user for extensions for copying/deleting much as yours does.
If I call Session.RemoveFiles("/myfolder/*.txt")
but I have a file: "/myfolder/subfolder/1.txt"
That 1.txt file is NOT deleted because it is in a subfolder.
Yet if I call Session.RemoveFiles("/myfolder/*.*") then that 1.txt file is deleted (along with every other file regardless of subfolder) as well as all subfolders themselves.
This is inconsistent behavior. It needs to be one way or the other. Either RemoveFiles should parse through all subfolders or it shouldn't. Personally the way I assumed it worked is the way that 7-Zip and other programs handle extensions in that:
\*.txt deletes only .txt files in that exact folder
\*.* deletes only files in that exact folder
\* deletes all files including all subfolders
Or just providing a Boolean recurse option to the function to control this (7-Zip does that also).
What RemoveFiles does right now is a mismatch.