stg68 Posted May 1, 2008 Share Posted May 1, 2008 What is the best method of moving files from one directory to another by excluding files by name. For instance, Move all files from directory A to directory B where file names are not FirstFile.txt, SecondFile.txt and ThirdFile.txt Best Regards Link to comment Share on other sites More sharing options...
monoceres Posted May 1, 2008 Share Posted May 1, 2008 Quick example, storing excluded files in array #include <file.au3> Global $dir1="C:\test", $dir2="C:\test2" Global $excludes[3]=["FirstFile.txt","SecondFile.txt","ThirdFile.txt"] $files=_FileListToArray($dir1,"*",1) If UBound($files)>1 Then For $file In $files For $exclude In $excludes If $file=$exclude Then ContinueLoop 2 EndIf Next FileMove($dir1&"\"&$file,$dir2&"\"&$file,9) Next EndIf Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
stg68 Posted May 1, 2008 Author Share Posted May 1, 2008 Quick example, storing excluded files in array #include <file.au3> Global $dir1="C:\test", $dir2="C:\test2" Global $excludes[3]=["FirstFile.txt","SecondFile.txt","ThirdFile.txt"] $files=_FileListToArray($dir1,"*",1) If UBound($files)>1 Then For $file In $files For $exclude In $excludes If $file=$exclude Then ContinueLoop 2 EndIf Next FileMove($dir1&"\"&$file,$dir2&"\"&$file,9) Next EndIf Cool! THANKS A LOT! 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