Simpel Posted August 8, 2014 Share Posted August 8, 2014 (edited) Hi,I'm using following code:Global $FileName = "test.log" Global $copyPath = "H:\Temp\Test\Log\" FileCopy(@ScriptDir & "\" & $FileName,$copyPath) If @error Then _DebugOut("Copy failed: " & $copyPath) Else _DebugOut("Copied to: " & $copyPath) EndIfIf folder "Log" is not existing then FileCopy creates a hidden file "Log" at "H:TempTest" with 1KB. Second I'll get the message in my debug file "Copied to: H:TempTestLog". But it's not true.Any suggestions?I tried an asterisk at the end of my $copyPath as it is suggested >here.FileCopy(@ScriptDir & "\" & $FileName,$copyPath & "*")Now there will be no hidden file but @error leads always to "Copied to: H:TempTestLog".What's wrong?Regards Simpel Edited September 25, 2015 by Simpel solved SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted August 8, 2014 Moderators Share Posted August 8, 2014 Per the help file: The destination directory must already exist, except using with flag value $FC_CREATEPATH (8). For instance the combined flag $FC_OVERWRITE (1) + $FC_CREATEPATH (8) overwrites the target file and pre-checks for the destination directory structure and if it doesn't exist creates it automatically. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Simpel Posted August 8, 2014 Author Share Posted August 8, 2014 Thanks. I know. But it shouldn't try to create that folder. So I decided to take the default, what is '0' or left blank. It's not a solution for me. Simpel SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
Simpel Posted August 8, 2014 Author Share Posted August 8, 2014 Found out myself: $msg = FileCopy(@ScriptDir & "\" & $FileName,$copyPath & "*") If $msg = "1" Then _DebugOut("Copied to: " & $copyPath) Else _DebugOut("Copy failed: " & $copyPath) EndIf Now no hidden file is created while failing and the debug messages will be correct. Regards Simpel P.S. Caution: the $copyPath has to end with a "". SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 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