Jump to content

FileCopying Problem


Recommended Posts

Hiya guys,

I've been at this problem for three hours now so I though it was time to hand over for some advice from the guru's.

I'm using FileCopy but it isn't working properly. I think the reason is because the files which I am copying already exist, with the same name, in the destination folder. I thought that by setting the flag to 1 it would simply overwrite the current files but the copy doesn't seem to work and as far as I can tell from some testing its because its trying to copy files that are already there.

I wondered if anybody else had experienced this problem or anybody knew a way round it other than simply setting the flag to 1????

Thanks

Mark

Link to comment
Share on other sites

......

hello

what about asking borgs ? :lmao:

ok, more seriously, the flag 1 is enough to overwrite existing files. I suggest you to check that:

- you are trying to copy files (not directories or something else...)

- you have read permission at source location.

- you have write permission at destination location.

Link to comment
Share on other sites

LOL, if only I could assimilate information like they do!!!!

Anyways, below you'l see the lines of script, I'm using wildcards but pretty sure that I'm copying files. And I have both read and write permission because I can try it with a randomly named file and it works fine. Its just when I copy over these files where there is already a version present in the destination directory!!

FileCopy("C:\EK HIERARCHY\errorlog\data\" & $time & "\*.*", "C:\EK HIERARCHY\errorlog\Subject\", 1)

I've done some testing to find out what the problem could possibly be and the error only occurs when trying to write files that already exist in there. Thats why I think its a problem overwriting the files....but I dont see why???

Any help greatly appreciated

Mark

Link to comment
Share on other sites

try

FileCopy("C:\EK HIERARCHY\errorlog\data\" & $time & "\*.*", "C:\EK HIERARCHY\errorlog\Subject\*", 1)

this should work

or you can try

FileCopy("C:\EK HIERARCHY\errorlog\data\" & $time & "\*.*", "C:\EK HIERARCHY\errorlog\Subject\*", 9)

i tested both and they work

Link to comment
Share on other sites

Hey,

I've tried both ways and neither is working. If they work on your computer then I assume the problem is something to do with the fail. But I can't for the life of me understand what because when I do the process manually then it works...I just have to dismiss a message box which says:-

Confirm File Replace

This file already contains a read only file named 'pre_imp_item_importrejects.txt'

Would you like to replace the existing file with this one?

Yes Yes To All No Cancel

I don't know if this can shed any light on the problem???

Thankyou for your continued efforts

Mark

Link to comment
Share on other sites

Hiy Guys,

After four hrs of banging my head on my desk I've finally figured out the problem. It seems that the script won't copy files that are read only??? I'm not sure why and I assumed I had both read and write access writes because I could copy them manually but obviously not.

Anyways, thankyou for those of you that looked over my problem for me, I hope that others ca use this example to their benefit....I'm sure there must be people out there as stupid as me that need this kind of basic rubbish!!!!!

Cheers guys

Mark

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