Quote:
Originally Posted by
chatwithsaurav
Thanks Rudi...
Hi Don
Can you please throw some more light on the code which u shared. Its working but removing all the rest of the files. Can the "*" in the for loop be replaced with anything else?
Did you not read my post?
The first line of that post in bold red text warned you not to run those examples. The last line of that post explicitly said that the second script would destroy all but one of the files in that directory. What it does is correct the name of every regular file in your current directory with a name ending in
.txt to the name that you said the user should have named the file in the first place.
As many of us have repeatedly stated: Unless you can define what constitutes a valid name and specify how to map an invalid name to the "correct" valid name, that script is the best we can do (and IT IS NOT SUITABLE FOR ANY USE other than to show that we don't have enough information to do what you seem to want).
All that you have really told us is that you have a directory that contains some files. Some of the filenames are bad. There is one good name (
advext_OK_2015_mem_rule_firings.txt). There may be other good names. Fix the bad filenames.
Our crystal balls aren't that good.