Remove a lot of UUID format named files using rm

I'm having a lot of files in a directory under a linux Environment. The problem is that those files are mixed with also a lot of UUID named files that who knows how got there.

Is there a way to issue a "rm" command that allows me to delete those files? without the risk of removing the other files (None of the other files have a UUID format for filename).

I think it has something to do by defining how many characters there is before each " - " simbol, so something among the lines of "rm 8chars-4chars-4-4-12" but I don't know how to say that to rm, I only know "rm somefolder/*" using * to delete its contents, but that's it.

Thanks in advance.

Upvotes: 2

Views: 1748

Answers (1)

Actually solved it!
It was as easy as using the "?" wildcard, it determines a character and only one character.
So, in this particular case:

rm -v ????????-????-????-*  //This says "remove (verbosely) 8-4-4-whatever"

So, that way, it deletes only files that follow this same format for the filename.

More information here: http://www.linfo.org/wildcard.html

Upvotes: 4

Related Questions