2

I have inherited a legacy project that was built on a windows machine. I work in OSX and one of the build commands is:

xcopy /y /r /i /d $(TargetDir)*.* $(TargetDir)$(ConfigurationName)

I have little to no experience working in Windows; but will need to replace this in order to get the build running smoothly.

How do I run this on OSX?

0

1 Answer 1

3

Xcopy is a DOS / Windows command. To my knowledge there is no way to runs this directly on Mac.

xcopy basically just copy files from one directory to another. Your command runs with these switches:

/y Suppresses prompting to confirm that you want to overwrite an existing destination file.

/r Copies read-only files.

/i If Source is a directory or contains wildcards and Destination does not exist, xcopy assumes Destination specifies a directory name and creates a new directory. Then, xcopy copies all specified files into the new directory. By default, xcopy prompts you to specify whether Destination is a file or a directory.

/d Copies source files changed on or after the specified date only. If you do not include a MM-DD-YYYY value, xcopy copies all Source files that are newer than existing Destination files. This command-line option allows you to update files that have changed.

You could use a tool available on Mac that does something similar instead, such as rsync.
So basically to do the same, you just need to copy things from one folder to another and keep in mind the different switches to take into account how it chooses what to copy.

4
  • What about the *.* after the first instance of $(TargetDir)? How does that translate? Dec 3, 2018 at 12:00
  • 2
    @AndrewHill *.* can be omitted since rsync copies all files by default. Dec 3, 2018 at 12:18
  • 2
    rsync is not a Mac tool, but it's a tool available on Mac (you can also have windows versions and that does not make it a windows tool either)
    – Geoffroy
    Dec 3, 2018 at 16:44
  • 2
    @Geoffroy you are correct, did not mean to imply that the tool was Mac only. Corrected my wording to point out that it is available on Mac. Dec 4, 2018 at 8:24

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.