afcartman 0 Posted January 25, 2007 I want to add a piece of code to my program that will move all the things on the users desktop into a different folder. This is the code I've tried but it doesn't work...just to give you an idea of what I'm trying ot get done. $search = FileFindFirstFile(@DesktopDir & "*.*") If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop $a = FileGetLongName($file) FileMove($a, "C:\mydir") WEnd FileClose($search) Share this post Link to post Share on other sites
Bert 1,427 Posted January 25, 2007 Try this. You forgot to add the "\" to separate the file name from the folder name. $search = FileFindFirstFile(@DesktopDir & "\*.*") If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop $a = FileGetLongName($file) FileMove($a, "C:\mydir") WEnd FileClose($search) The Vollatran project _____ I'm famous My blog: http://www.vollysinterestingshit.com/ Share this post Link to post Share on other sites