Jump to content

Filecopy exclude


gfunk999
 Share

Recommended Posts

Hi All,

How can we exclude files/directories with filecopy and dircopy? I know this has been brought up before, but the answer was to use xcopy to exclude files/directories. Is this still the case, or is there a way to accomplish this without having to use command utilities?

FileCopy("C:\*.txt", "C:\backup\", 9)

DirCopy("C:\", "E:\backup\", 1)

Want to exclude:

C:\program files

C:\System Volume Information

Also, if you noticed this command -> DirCopy("C:\", "E:\backup\", 1) does not copy the subdirectories, only the files in C:\. Am I doing something wrong?

Thank you Gary

Link to comment
Share on other sites

I would use FileFindFirstFile() FileFindNextFile() check it against my list of excludes and FileCopy() if it passes. You can still use DirCopy() just use If StringInStr(FileGetAttrib($File),"D") to see if it is a folder. Don't forget to FileClose() when you are done.

Link to comment
Share on other sites

Thanks for the quick reply John, I understand how to use FileFindFirstFile() & FileFindNextFile(); however, how do I use the exclusion list? Could you please post a small sample?

I would use FileFindFirstFile() FileFindNextFile() check it against my list of excludes and FileCopy() if it passes. You can still use DirCopy() just use If StringInStr(FileGetAttrib($File),"D") to see if it is a folder. Don't forget to FileClose() when you are done.

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