John Adam said:
Sorry to all I should not use the word "group" I should have use related ....
The only grouping is if you have files related by the same name exp.
(backup01.zip ,backup02.zip) they will be in the same group but backup9.zip
will not
backup.zip***** arraylist1
backup01.zip***** arraylist2
Well okay it is possible... If you really want to do this I think you'll be
writing a pattern matching operation. Something on the order of:
Take the first item from the list and mark it as belonging to list "1"
(don't move them, just mark them.)
Take the next item and match it using whatever criteria you want, extension,
first part of the filename, number of digits, whatever and compare it to all
previous items. If you find that it matches then mark it with the same
number as the match. If it doesn't match assign it a number 1 greater than
the highest number so far.
Repeat for each subsequent item.
When you are done each string has a number that represents which "group" it
belongs to according to the matching rules you've devised. If you don't
like the results you adjust the rules and run it again. Eventually your
rules will work for everything you've tested. Depending upon the complexity
of the rules they will probably match any new file names also but it is
possible that something "leaks"... if items don't get into the proper group
you adjust your rules to handle the new situation.
Note that this doesn't require sorting the filenames or separating them by
extension first. It is completely rule-based.