Jump to content

Recommended Posts

Posted (edited)

For some reason I can't get this to copy. It displays what it should look like in a message box as far as the path but just won't copy files. The files types are being read from an ini file into an array with StringSplit but can't it to copy any type matching that to the specified directory.

$SFDestination = IniRead($ConfigFile, "ConfigSet", "SFLocation", "NotFound")
$SearchType = IniRead($ConfigFile, "ConfigSet", "Search", "NotFound")
$SearchFile = StringSplit($SearchType, "|")
$sCheckPath = FileGetAttrib($SFDestination)
If Not StringInStr($sCheckPath, "D") Then 
DirCreate($SFDestination)
EndIf
GUICtrlSetData($Console, "Scanning for specific file types." & @CRLF, 1)
For $c = 1 To $SearchFile[0]
GUICtrlSetData($Console, "Transferring " & $SearchFile[$c] & " files, please hold." & @CRLF & @CRLF, 1)
FileCopy("C:\*" & $SearchFile[$c], $SFDestination, 9)
Next

Thanks

Edit: yes I know the Dircreate part is kinda redundant when using the Filecopy 9 flag.

Edited by EndFunc
EndFuncAutoIt is the shiznit. I love it.
Posted

It still doesn't like that. It just zooms by. I even tried doing this.

FileCopy("C:\*" & $SearchFile[$c], $SFDestination & "\*.*", 9)

And still doesn't work. Hmm??

EndFuncAutoIt is the shiznit. I love it.
Posted

It may depend what is in your ini file perhaps. Test works ok for me with the below.

FileChangeDir('c:\')
$ConfigFile = 'config.ini'

$SFDestination = IniRead($ConfigFile, "ConfigSet", "SFLocation", "NotFound")
$SearchType = IniRead($ConfigFile, "ConfigSet", "Search", "NotFound")
$SearchFile = StringSplit($SearchType, "|")
$sCheckPath = FileGetAttrib($SFDestination)
If Not StringInStr($sCheckPath, "D") Then
    DirCreate($SFDestination)
EndIf
;~ GUICtrlSetData($Console, "Scanning for specific file types." & @CRLF, 1)
For $c = 1 To $SearchFile[0]
;~  GUICtrlSetData($Console, "Transferring " & $SearchFile[$c] & " files, please hold." & @CRLF & @CRLF, 1)
    FileCopy("C:\*" & $SearchFile[$c], $SFDestination, 9)
Next

Ini file used.

[ConfigSet]
SFLocation=folder
Search=.txt

And I finished with "folder" with a txt file inside from c:\.

Posted

that's weird because I still can't get it to work. It just zips right by. is there a better way to do this maybe?

EndFuncAutoIt is the shiznit. I love it.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...