afcartman Posted January 25, 2007 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)
Bert Posted January 25, 2007 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 My blog: http://www.vollysinterestingshit.com/
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