Jump to content
Sign in to follow this  
gfunk999

Filecopy exclude

Recommended Posts

gfunk999

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

Share this post


Link to post
Share on other sites
John

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.

Share this post


Link to post
Share on other sites
gfunk999

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.

Share this post


Link to post
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
Sign in to follow this  

×