Guidance
指路人
g.yi.org
software / rapidq / Examples / File & Directory / CopyDir.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'CopyDir
'(Nov. 5, 2001)
'By Achilles Mina
'This is an elaboration of the solution I posted on the message board
'in response to a request for a way to copy a directory and its contents.
'It uses x = SHELL("c:\windows\command\xcopy c:\OldDir\ c:\NewDir\ /e",0)
' There are other ways, but this seems the simplest and most economical, using just one line.


     DECLARE FUNCTION Setfocus LIB "user32" ALIAS "SetFocus"(hwnd AS LONG) AS LONG
     DECLARE SUB ProcessKey(key, Sender AS QEDIT)

     CREATE Form AS QFORM
      CAPTION = "Copying a directory and its contents"
      Width = 320
      Height = 240
      Center
      CREATE Edit1 AS QEDIT
       Text = "Enter path and name of old directory"
       Left = 50
       Top = 100
       Width = 209
       OnKeyPress = ProcessKey
      END CREATE
      CREATE Edit2 AS QEDIT
       Text = "Enter path and name of new directory"
       Left = 50
       Top = 130
       Width = 209
       OnKeyPress = ProcessKey
      END CREATE
      CREATE Panel AS QPANEL
       Left = 50
       Top = 45
       Width = 209
       CAPTION = "Contents of old will be copied to the new"
      END CREATE
      SHOWMODAL
     END CREATE

     SUB ProcessKey(key, Sender AS QEDIT)
      IF key = 13 THEN
       SELECT CASE Sender.Handle
       CASE Edit1.Handle
        SetFocus(Edit2.Handle)
       CASE Edit2.Handle
        x = SHELL("c:\windows\command\xcopy " + Edit1.Text + "\ " + Edit2.Text + "\ /e",0)
        Panel.CAPTION = "All contents copied to " + Edit2.Text
       END SELECT
      END IF
     END SUB

掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2024-4-25  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2001-11-08 06:17:46