Jump to content

choose folder


Recommended Posts

I want to do some backups and I want to be abale to make the folder for the backup and where I can put the backup folder could someone show me how to use the open folder and save it to the script .

FileCopy (@WindowsDir & "\*.dll", "E:\backups\dlls", 1)

I have that hard coded in but would like to pick the folder and make it for the backup .

Thanks if you can help . sorry if this is a dumb question but i don't understand a lot of this .. :ph34r:

Link to comment
Share on other sites

Not sure how to do that ?

In the help file it shows the switches at the end you can use to allow a file that does not exist to be written in

after doing that use dircreate to make it a folder instead.

This way if the folder already exists the user will select it and direcreate will have no effect

Rick

Link to comment
Share on other sites

bobheart, what about this?

GUICreate("BUP", 320, 280)
$label1 = GuiSetControl("label", "",  10, 10, 300, 20, 0x1000)
$choose = GUISetControl ("button", "Choose Folder", 10,40,100,20)
GuiSetControlNotify()
$md = GUISetControl ("button", "Make Folder", 10,60,100,20)
GuiSetControlNotify()
;----------------------------------------------------------

GuiShow()
While GUIMsg() <> -3
$msg = GuiRead()
Select

;------------------
Case $msg = $choose
$backup_path = FileSelectFolder("Choose Backup Dir", "", 0)
GuiWrite($label1,0,"Backuppath: " & $backup_path)

;------------------
Case $msg = $md
$new_folder_name = InputBox("New Folder", "Enter new Foldername:")
$where_to_put = FileSelectFolder("Where to create new Folder?", "", 0)
$ret = DirCreate($where_to_put & "\" & $new_folder_name)
If $ret = 1 Then
$backup_path = $where_to_put & "\" & $new_folder_name
GuiWrite($label1,0,"Backuppath: " & $backup_path)
Else
MsgBox(0, "!!!", "Error!")
EndIf

;---------
EndSelect
Wend

Just an example. No errorhandling.

arctor

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...