kkman360 Posted April 4, 2006 Share Posted April 4, 2006 it does not work!why? code: $search = FileFindFirstFile("d:\test\*.*") If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error then MsgBox(0, "ok", "copy complete") ExitLoop endif FileCopy("d:\test\dc\*.*","d:\test\" & $search & "\*" ,1) WEnd ; Close the search handle FileClose($search) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 4, 2006 Moderators Share Posted April 4, 2006 Wow, I can't make heads or tails of what your doing... Can you just say what you want... from what I see, the $search in file copy is wrong, but I don't know why you are doing the filefindnext, if your just copying the entire folder, and then I don't know why you have "\*" as your extension in file copy. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Valuater Posted April 4, 2006 Share Posted April 4, 2006 1 try this MsgBox(0,"d:\test\dc\*.*","d:\test\" & $file & "\*") ;FileCopy("d:\test\dc\*.*","d:\test\" & $file & "\*" ,1) 2 dont you want to copy from $file... to the new location?? 8) Link to comment Share on other sites More sharing options...
kkman360 Posted April 4, 2006 Author Share Posted April 4, 2006 (edited) i have 1290 folders in d:\test and copy d:\test\dc\*.* to each one. and $search is name of folder? thanks. Edited April 4, 2006 by kkman360 Link to comment Share on other sites More sharing options...
Valuater Posted April 4, 2006 Share Posted April 4, 2006 i have 1290 folders in d:\test and copy d:\test\dc\*.* to each one. thanks. might want to look into FileListToArray() to use folders/ and or files #Include <File.au3> #Include <Array.au3> $FileList=_FileListToArray("d:\test\") If (Not IsArray($FileList)) and (@Error=1) Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf _ArrayDisplay($FileList,"$FileList") ** not tested Optional: specifies wheather to return files folders or both $iFlag=0(Default) Return both files and folders $iFlag=1 Return files only $iFlag=2 Return Folders only 8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 4, 2006 Moderators Share Posted April 4, 2006 Without testing it, I would imagine it might look like this:$search = FileFindFirstFile("*.*") If $search = -1 Then Exit While 1 $file = FileFindNextFile($search) If @error Then ExitLoop If StringInStr(FileGetAttrib($file), 'd') Then FileCopy("d:\test\dc\*.*", "d:\test\" & $file & '\', 1) WEnd FileClose($search) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
kkman360 Posted April 4, 2006 Author Share Posted April 4, 2006 (edited) yes! you are right. ha ha . i get a mistake .must use $file not $search . thanks evry much. Edited April 4, 2006 by kkman360 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 4, 2006 Moderators Share Posted April 4, 2006 yes! you are right. ha ha . i get a mistake .must use $file not $search .thanks evry much.you get "your" mistake?Also.. to make sure your not trying to copy to a non-folder, you might try the Filegetattribute() option I put up there. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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