Script to change weird filenames
Hi all,
I have a Linux server (Gentoo) that receives input from users' systems.
For each input, a small text file is created based on the request e.g. REQ_2355.20080313.DAT). The 2355 is a category and REQ is a key meaning REQUEST.
It works fine until users miskey in Chinese or other weird chars; the filenames would be something like ???REQ_????2344.20080313????.DAT or __---REQ---.DAT.
I would like to have a script that detects such weird names and rename the files to maybe archive1.DAT, archive2.DAT etc. (if there are more than these weird filenames).
Also I have come across filenames that begin with a hyphen ('). These files I find it even to rename manually.
Please assist.
While all these can be renamed manually, I have been losing sleep (a lot of these things seem to happen in the wee hours).
Thanks in advance.
Eric
|