[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 316
  • Last Modified:

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.
0
winman_soft
Asked:
winman_soft
  • 4
  • 2
4 Solutions
 
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now