Due to a program that wasn't functioning well, I have many files in my home directory starting with a dot and containing strange symbols among which are spaces and asterisks. I want to delete these files, but am having trouble doing so. This problem is similar to Rename file containing spaces and punctuation marks, but much worse. There are way too many files to remove by hand so I will have to use pattern matching.
Most files start with
.txt} and contain
18Jun22h (and no files in the directory that I want to keep contain either of these strings). How do I remove all files containing this string given that the files in the directory are certainly not nice unix name? Instead, they contain dots spaces asterisks and brackets and dashes. My initial attempts are failing presumably due to the presence of these symbols in these names.
Any method that deletes them one by one would be completely useless to me due to the quantity of files.
Yes I know it is better to not have files not living up to the unix standard. This is a code I also live by. But a script did not work as it should.
As a second thought, it might be easier to delete all files produced (in the specific directory) between certain times. So alternatively help with this is appreciated.
System: Fedora 27
I had tried
~/*18Jun22h* but thought that the error saying the argument was too long had to do with the *'s in the filenames expanding and doing something strange. Instead it is just because there are too many files matching this pattern (right?). (I did not know that there is a max on the number of files rm can handle).