moving files to different folders based on extension
Posted: Mon Feb 04, 2008 8:03 pm
{this is for Windows}
For a program I am writing need to be able to seporate files in a folder into 2 different folders
In my program I have user select a folder and it put files into fList.
now I want to move certain files (based on user defined extensions) into one folder (call it Folder A) and others (based on second list of extensions) into another and ignor all other files.
The folders are already created.
There are fields for the user to put the file extentions into.
fld Graphics and fld Documents. The defaults for Graphics is: .txt, .doc
and the defaults for Documents is: .jpg, .gif, .png but the user can add more (seporating with comma).
I have tried several recursive methods to go through the files and move them to the the folders but nothing has worked so far. My main problem is I cant figure out how to pull the file path out of fList based on the extension.
much thanks in advance.
For a program I am writing need to be able to seporate files in a folder into 2 different folders
In my program I have user select a folder and it put files into fList.
now I want to move certain files (based on user defined extensions) into one folder (call it Folder A) and others (based on second list of extensions) into another and ignor all other files.
The folders are already created.
There are fields for the user to put the file extentions into.
fld Graphics and fld Documents. The defaults for Graphics is: .txt, .doc
and the defaults for Documents is: .jpg, .gif, .png but the user can add more (seporating with comma).
I have tried several recursive methods to go through the files and move them to the the folders but nothing has worked so far. My main problem is I cant figure out how to pull the file path out of fList based on the extension.
much thanks in advance.