Jump to content
Sign in to follow this  
jbennett

Adding overwrite to copy

Recommended Posts

jbennett

Hi,

Does anyone know how I can add something to the following code so that it will automatically overwrite existing files if there is any. Thanks

I know I can do this with filecopy by using ",1" but want to keep my progress bar :-)

_FileCopy ($working_location & "*", $backup_location & @computername)

Func _FileCopy($fromFile,$tofile)
    Local $FOF_RESPOND_YES = 16
    Local $FOF_SIMPLEPROGRESS = 256
    $winShell = ObjCreate("shell.application")
    $winShell.namespace($tofile).CopyHere($fromFile,$FOF_RESPOND_YES)

EndFunc

p.s. I would like to add a msgbox to this that displays some information if the backup is complete, but maybe I'm asking a bit much with that question :-)

I can stick a msgbox at the end of function code and it will pop up nicely, but if the user clicks cancel or the cross within the progress bar then it still displays the msgbox which is a bit misleading.

Thanks

Edited by jbennett

Share this post


Link to post
Share on other sites
Valuater

These are the only ones I know

;~ 4 Do not display a progress dialog box.  
;~ 8 Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists.  
;~ 16 Respond with "Yes to All" for any dialog box that is displayed.  
;~ 64 Preserve undo information, if possible. 
;~ 128 Perform the operation on files only if a wildcard file name (*.*) is specified.  
;~ 256 Display a progress dialog box but do not show the file names.  
;~ 512 Do not confirm the creation of a new directory if the operation requires one to be created.  
;~ 1024 Do not display a user interface if an error occurs.  
;~ 2048 Version 4.71. Do not copy the security attributes of the file. 
;~ 4096 Only operate in the local directory. Don't operate recursively into subdirectories. 
;~ 9182 Version 5.0. Do not copy connected files as a group. Only copy the specified files.

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
PsaltyDS

These are the only ones I know

;~ 4 Do not display a progress dialog box.  
;~ 8 Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists.  
;~ 16 Respond with "Yes to All" for any dialog box that is displayed.  
;~ 64 Preserve undo information, if possible. 
;~ 128 Perform the operation on files only if a wildcard file name (*.*) is specified.  
;~ 256 Display a progress dialog box but do not show the file names.  
;~ 512 Do not confirm the creation of a new directory if the operation requires one to be created.  
;~ 1024 Do not display a user interface if an error occurs.  
;~ 2048 Version 4.71. Do not copy the security attributes of the file. 
;~ 4096 Only operate in the local directory. Don't operate recursively into subdirectories. 
;~ 9182 Version 5.0. Do not copy connected files as a group. Only copy the specified files.

8)

Strange... Bit 13 set = 2^13 = 8192, not 9192. What did you copy that out of? If it's in AutoIt documentation we need to tweak it.

Ref: System.Shell.Folder.copyHere

:mellow:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
jbennett

Hey,

How did you find all them numbers, is it possible to find it in the AutoIT documentation on my PC?.

Also is there any way of letting the program know if the user closes the progress bar with the 'Cancel button' or the 'X'

Thanks

Share this post


Link to post
Share on other sites
PsaltyDS

Hey,

How did you find all them numbers, is it possible to find it in the AutoIT documentation on my PC?.

Also is there any way of letting the program know if the user closes the progress bar with the 'Cancel button' or the 'X'

Thanks

Did you try the links we posted? Google + MSDN is your friend.

I don't think this is in the AutoIt docs.

:mellow:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.