Copy with permissions

We have a vb.net application to backup data in our server , but when the files are copied the permissions will not be retained.
Can anyone let me know how to copy data in VB.NET and retain the permissions.
winman_softAsked:
Who is Participating?
 
Amitabh SinghAWS Certified Solution Architect | L3 IT Specialist for CloudCommented:
Hi
you can use robocopy for your program !

Example :
Process.Start("ROBOCOPY", "ROBOCOPY source destination /MIR  /SEC")

have a look to the post below how to run robocopy !
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/2003_Server/Q_22041945.html?sfQueryTermInfo=1+10+30+ntf+permiss+robocopi

http://ss64.com/nt/robocopy.html
----------------------------------
and running DOS command in VB.NET
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_21952833.html?sfQueryTermInfo=1+10+30+command+do+run+vb.net
0
 
Amitabh SinghAWS Certified Solution Architect | L3 IT Specialist for CloudCommented:

Example :
Process.Start("ROBOCOPY", "source destination /MIR  /SEC")
0
 
winman_softAuthor Commented:
thanks for the reply..
Can it be done using GetAccessControl() and SetAccessControl()?
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
Amitabh SinghAWS Certified Solution Architect | L3 IT Specialist for CloudCommented:
well nothing is impossible (you need to extract user/group setting one by one , set the output  to a variable and then apply this variable to destination location ), but i never did this via GetAccess/SetAccess because there is easy and fast methods are exist for this

their is one windows command xcopy which can do same thing for you
Example :
http://stackoverflow.com/questions/7520389/how-to-make-vbscript-copy-permissions-along-with-files
0
 
winman_softAuthor Commented:
I had used xcopy for backup.. but it gave me some errors.
So, Can i copy only the permissions using xcopy?
0
 
Amitabh SinghAWS Certified Solution Architect | L3 IT Specialist for CloudCommented:
no you can not copy only permissions using xcopy (xcopy will copy data and permissions together )

but if you  just want to copy folder  permissions then you can use xcacls command

how to use xcalcs.vbs
http://support.microsoft.com/kb/825751

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.