Jump to content

How actually FileCopy() works ?


Recommended Posts

Well... I've tested the FileCopy() function... I'm not sure if it is

working under restricted account in Windows 2000.

My idea is like that....

I do a mapped-drive (to other PC) using DriveMapAdd() function.

Afterwards, I wanted to copy files from mapped-drive to current

PC's C:\Program Files\test location.

Assume mapped-drive is X:

So, the syntax looks something like this :

FileCopy ("X:\*.bin", "C:\Program Files\test", 1)

However, I tested it in Windows 2000 (Restricted User) account,

it seems to be not working at all.

What had gone wrong with it ?

Please help. Thanks in advance

Link to comment
Share on other sites

Well... I've tested the FileCopy() function... I'm not sure if it is

working under restricted account in Windows 2000.

My idea is like that....

I do a mapped-drive (to other PC) using DriveMapAdd() function.

Afterwards, I wanted to copy files from mapped-drive to current

PC's C:\Program Files\test location.

Assume mapped-drive is X:

So, the syntax looks something like this :

FileCopy ("X:\*.bin", "C:\Program Files\test", 1)

However, I tested it in Windows 2000 (Restricted User) account,

it seems to be not working at all.

What had gone wrong with it ?

Please help. Thanks in advance

<{POST_SNAPBACK}>

What does this return? Does it say it is working?
Link to comment
Share on other sites

Guest BL@(K-R34P3R

Is the file that you are trying to copy already in that directory? If so, then it will be copying it, but it will just be copying over the original file, and therefore not "show" anything.

Link to comment
Share on other sites

I know the below coding has many problems. This is what I wanted to do :

First of all, there are 2 PCs, one is PC1 (Restricted User) and another is

PC2, both are running LAN environment (Workgroup only).

I want to perform a map-drive from PC1 to a PC2, then check only the

latest modified date I want to copy. If the file does not exist in PC1, then

copy it over. That's all.....

Please help me to correct the coding below... I know it is very bad :)

RunAsSet("Administrator", @Computername, "erots")

   DriveMapAdd ("X:", "\\192.168.24.21\update")
   $path = @ProgramFilesDir & "\Grisoft\AVG6\UPDATE"
   $temp = FileGetTime ("C:\Program Files\Grisoft\AVG6\UPDATE\*.bin", 0)

   $search = FileFindFirstFile ("X:\*.bin")
             
   $val = FileCopy ("X:\Files.txt", "C:\Program Files\Grisoft\AVG6\UPDATE\", 1)

   WHILE 1 
        $file = FileFindNextFile($search)
        MsgBox (4096, "File :", $file)

        IF NOT @ERROR THEN
           $t = FileGetTime($file)

           IF NOT @ERROR THEN
              $mddyyy = $t[1] & "/" & $t[2] & "/" & $t[0]
              MsgBox (0, "Modified Date :", $mddyyyy)
           ENDIF     
        ENDIF
   WEND

   FileClose ($search)

   DriveMapDel ("X:")

RunAsSet()
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...