mud409 Posted May 9, 2010 Share Posted May 9, 2010 Been a while since I've used autoit, and kind of out of touch with it. So I need a little push in right direction on where to start with this. Basically I have a txt file with a bunch of file names (just the name, no extention). Then I have a directory with thousands of files, including all of the file names that are in my text file. I need a way to extract those that are in the list, or delete all that are not in the list. Link to comment Share on other sites More sharing options...
hawky358 Posted May 10, 2010 Share Posted May 10, 2010 (edited) Hey One way would be to use _FileListToArray() on the folder in question, then filereadline() the textfile, and do a arraysearch(). After finding the file you can move it, or add it to a move list or something something like this $keep = fileopen("list.txt",0) $currentlist = _FileListToArray($folderpath) _ArrayTrim($currentlist,3,1) do $file = filereadline($keep) $err = @error _arraysearch(...) filemove() until $err =-1 This code is just a guide, not a working script (You can also look at reading the text then using FileFindFirstFile() to find it and move it) This is probably not the most efficient way, but It will work. Edited May 10, 2010 by hawky358 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now