Click here to Skip to main content
15,888,020 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
Hi all! I've got one client machine that fails when using my application attempting to copy thousands of files from an USB stick. An error message is thrown after a few files are copied, and a lot of folders are created on the hard drive. The error message says that the USB stick is write protected, but hey... I'm not trying to copy anything TO the stick, but FROM it. Any clues?

What I have tried:

I have tried using the file manager to copy all content from the USB stick to the hard drive first, which went well, and then to let my application copy all files and folders from one folder to another folder on c:\, which also went well. So it's only when copying from USB to hard drive using my application that the error message pops up, and the copy process halts after only a few files.
Posted
Comments
[no name] 24-Oct-16 17:53pm    
Maybe you should look at the client machine and see it there is something there that will give you a clue.
[no name] 24-Oct-16 18:54pm    
Well alright then member for NINE freaking years and still can't figure out how to ask a question, if you don't want help then just say so. We can't see your code or the other computer or read your mind to know what your code is doing.
[no name] 25-Oct-16 6:44am    
You're welcome. Good luck getting help with your attitude.
Dave Kreskowiak 24-Oct-16 19:12pm    
He's correct. You absolutely need to look at the machine in question. It's not going to be a code thing.

You have to look at the machines event logs, virus scanner (if any) logs, do a full scan, USB drivers up to date, motherboard chipset drivers, ...
[no name] 25-Oct-16 6:45am    
How can you say that? You haven't given us any idea at all about the problem other than you are unable to copy file on one machine. Can we see that machine? Can we see your code? Can we see any error message?

1 solution

The cause of the problem lies in the code:
There is an array containing thousands of files that should be copied.
Depending on earlier settings, possibly made months ago, some files should not be copied.
When the code skips copying a file that should not be copied, it should also skip checking the attributes of the file. But unfortunately the attribute checking was made outside the conditional statement, so it attempts to check files that were not copied.

So, the problem did not really lie in the machine it was discovered on, as I thought, but on any machine that had similar file excluding settings.

Since the error really is "The file is not there dude, so I cannot check the attributes on it", but instead it says that the USB is write protected, the error message gotten is not at all relevant.

Now, let me know exactly how stupid you think I am. I don't mind - at least I'm not as stupid as the faulty error message sending me off on a wild goose hunt. Sure, I should have built in robust error handling here. No matter how much error handling I include, it seems that there always will be a few lines of code I forget... sigh.
 
Share this answer
 
v2
Comments
F-ES Sitecore 25-Oct-16 10:47am    
So the problem was in code that you didn't post and didn't think was worth posting so your question was unanswerable As a user said earlier, you need to learn how to ask a question. Having an issue with the code but not posting it is like phoning up a garage and saying "my car's not working, what's wrong with it?", you're not giving people the info they need to help.
Dave Kreskowiak 25-Oct-16 13:28pm    
The quality the of the answers you get is DIRECTLY dictated by the quality of the question you ask. Leave out important details and you're going to get very generalized answers.

No matter how you try to spin this, the problem with this entire thread derives from you.
abbabbabba 25-Oct-16 17:43pm    
Read through all comments here, and each one was more childish than the other, so I decided to delete them all. Not sure if it worked though.
The question and the solution should remain for others to enjoy.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900