Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ VB
hello guys how are you
How can i copy a hidden files to pc?
Posted 13-Jan-13 20:00pm
Comments
Sergey Alexandrovich Kryukov at 14-Jan-13 2:14am
   
The same was as not hidden.
—SA
alcitect at 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"
Try
FileCopy(source, Dest)
Catch
MsgBox(Err.Description, MsgBoxStyle.Critical, "Error")
End Try
</pre>
Jochen Arndt at 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 at 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
good
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
 
Use
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.
  Permalink  
Comments
alcitect at 15-Jan-13 1:10am
   
CHill60 thank you for replay
I use VB.net 2008,
i use that code also, but the problem was it can't see the hidden file
CHill60 at 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 at 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
0 Sergey Alexandrovich Kryukov 330
1 BillWoodruff 314
2 George Jonsson 274
3 CPallini 265
4 OriginalGriff 257
0 OriginalGriff 5,030
1 CPallini 4,115
2 Sergey Alexandrovich Kryukov 3,554
3 George Jonsson 2,826
4 Gihan Liyanage 2,386


Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 14 Jan 2013
Copyright © CodeProject, 1999-2014
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