Click here to Skip to main content
13,139,034 members (54,825 online)
Rate this:
Please Sign up or sign in to vote.
See more:
hello guys how are you
How can i copy a hidden files to pc?
Posted 13-Jan-13 20:00pm
The same was as not hidden.
alcitect 15-Jan-13 1:01am
oh hi sergey
I try this but it not work
<pre lang="vb">
Dim source As String = "F:\Teaching\test.exe"
Dim Dest As String = "c:\test.exe"
FileCopy(source, Dest)
MsgBox(Err.Description, MsgBoxStyle.Critical, "Error")
End Try
Jochen Arndt 14-Jan-13 11:38am
If you want to get an answer from Sergey, use the 'Reply' button right of the comment (like I have done with this post). Then he gets a notification mail and may answer you.

With your example, it would be interesting to see the error message. You are trying to copy the file to the root directory of C:. This will fail on modern Windows systems with 'Access denied'. So the problem might be not the hidden state of the source file but the destination path. Please try first with a destination path where you are allowed to write to (e.g. use c:\Teaching\copy-test.exe).
alcitect 15-Jan-13 1:04am
thank Jochen Arndt
I make the program work as administrator to make it possible to copy to root directory of C:, and it work but with hidden file the program can't see it.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Given the sample you've posted in the comments I'm going to assume that you're using VB.Net and not C++ or VB.

Firstly FileCopy should work - you haven't given us a hint of why it doesn't.

Again I'm going to assume that you wanted the copy file to be hidden as well, so

System.IO.File.Copy(source, dest, True)

This will copy the file, overwrite it if it already exists and also copies the file properties, so the new file is also hidden.
alcitect 15-Jan-13 1:10am
CHill60 thank you for replay
I use 2008,
i use that code also, but the problem was it can't see the hidden file
CHill60 15-Jan-13 4:15am
Ok - well I know that both ways *will* copy a hidden file as I tested both, so it must be environmental. Exactly what error message is reported to you?
alcitect 16-Jan-13 0:19am
oh yes i test it and it work normaly.
thank you for atention

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170915.1 | Last Updated 14 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100