I need to make a copy of a file:

  1. with all the security (ACL) permissions - that's why I chose robocopy
  2. the copy must be in the same directory with new name obviously

The Robocopy syntax is drastically different from any other command line tools and I don't even know if it is possible to acheive this with robocopy?

What I have tried is:

robocopy c:\temp\ c:temp\ file1.txt file2.txt

however this does not work since this is the sintax to copy the two files listed but since the source & destination are the same the command is ignored... I am not sure it is possible...

  • This could be a great learning experience for you, and very simply answered by trial and error. Instead you came looking for someone to write the command for you. It appears you haven't even tried. – Appleoddity Jul 31 '17 at 17:32
  • it took me an hour of trial and error and I poisted the question because I am coming to the conclusion it is not possible... – Emil Jul 31 '17 at 17:52
  • Ok, but you haven't posted any information to show us how you were led to the conclusion this is not possible. You could've posted the various options and commands you tried and what results you achieved. – Appleoddity Jul 31 '17 at 17:56

Robocopy's primary use case is to mirror or migrate files from one path to a different path. It could be used to copy a single file to a different directory, but it does not rename files. Try the following powershell commands:

copy-item file1.txt file2.txt
get-acl file1.txt | set-acl file2.txt
  • Thanks - great suggestion; I'll give it a try and accept your answer if it works well. I shied away from using powershell as I found it very slow and sometimes unreliable with low level stuff like file permissions, because it is using mainly .net framework under the covers... – Emil Aug 1 '17 at 9:48

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.