Jump to content

copy map to another location


 Share

Recommended Posts

Dear reader,

I recently made a simple script to copy files to another location for backup services.

While 1
    $search = FileFindFirstFile("C:\test\*.pdf")

    If $search = -1 Then
        sleep(60000)
    Else
        $file = FileFindNextFile($search)
        filemove("C:\test\" & $file,"Z:\test",8)
    EndIf

    FileClose($search)
WEnd

now there are not only pdf files in the dir "test" but more files (.exe , .bat etc)  and sub dir like C:testtest2

I would like to also copy the directory's to the other location but don't understand how....

Zould somebody please help me or point me in the wright direction :)

greez

FMS

as finishing touch god created the dutch

Link to comment
Share on other sites

  • Moderators

If you're looking to copy the entire directory, look at DirCopy in the help file.

If you only want certain files, look at _FileListToArray and use the filter to grab only the files you want.

"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

thanks for the tip....

I looked in to it but,..

do you also know a way to check if there is a new file in the "sub dir" and iff so fire a dircopy command?

thanks in advanced

as finishing touch god created the dutch

Link to comment
Share on other sites

  • Moderators

Just to clarify, are you asking how to monitor a directory and if a new file is found move just that file? Or move the whole directory? Or just the pdf files? Can you please be a bit more specific?

Edited by JLogan3o13

"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

  • Moderators

Rather than re-write something, I would suggest you take a look at this thread where Melba presents a solid example of monitoring a directory. I would also encourage you to think about keeping a running list of the files in the directory (written to a text file, kept in an array, etc.) so that you're only moving those files that have been added. This will cause a lot less overhead than moving the entire directory each time.

'?do=embed' frameborder='0' data-embedContent>>

"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

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...