Batch copy time creation and modification date from files using OSX First of all, I have asked the same question at stack overflow, but I am not sure if it's right over there. That's why I decided to post it here, too.
t'm having a hard time trying to copy the creation and modification date of some files to other files.
I have converted some MXF files to MOV, but unfortunately the new MOV-files don't have the same creation date.
Now I had a look around for similar questions and found different answers, but this seems to be the simplest:

    #!/bin/bash
    for f in *.MXF; do
     touch -r "$f" "${f%MXF}mov"
    done



Unfortunately it doesn't work for me – neither with Terminal nor Automator.
I saved the Code with TextEdit. In Terminal I ran chmod+x to make the file executable and put it in the folder where my MXFs and movs are. 
But I'm just getting the following error:
touch: *.MXF: No such file or directory
I have also tried mxf instead of MXF.
This is the output of ls- l from the test folder

-rwxrwxrwx  1 username  staff  258458160  5 Jan  2014 570_0301.MXF
-rwxrwxrwx  1 username  staff  241431870  5 Jan  2014 570_0301.mov
-rwxrwxrwx  1 username  staff  974595120  5 Jan  2014 570_0306.MXF
-rwxrwxrwx  1 username  staff  911745994  5 Jan  2014 570_0306.mov
-rwxrwxrwx  1 username  staff  667679280  5 Jan  2014 570_0308.MXF
-rwxrwxrwx  1 username  staff  624468526  5 Jan  2014 570_0308.mov


Because I managed to get the modification date copied it seems that all the files already have the same date, but this doesn't cover the creation date.
Maybe someone could help me out? Will it change the modification and creation date? Because both are important...
Thank you very much in advance and all the best!



EDIT: Got the script working thanks to user3439894. 
But it still doesn't update the creation date... 
MXF: created 05.01.2014 06:49, modified 05.01.2014 06:50 
mov: created 23.06.2016 05:34, modified 05.01.2014 06:50 
Is there any way to correct this?
Since this is not working for you I'm going to suggest you do as fd0 suggested and use SetFile.  This will be used in conjunction with GetFileInfo, both of which are a part of Command Line Tools for Xcode.

You do not need to install the Xcode.app which is ~3.80 GB, just ~160 MB for Command Line Tools for Xcode.

In Terminal: xcode-select --install

See How to Install Command Line Tools in OS X Mavericks &amp; Yosemite (Without Xcode), which is also for OS X El Capitan.

Here is a bash script to use with SetFile and GetFileInfo:

#!/bin/bash

for f in *; do

    if [[ -f $f ]] &amp;&amp; [[ ${f##*.} == MXF ]] &amp;&amp; [[ -f ${f%.*}.mov ]]; then

        cDate="$(GetFileInfo -d "$f")"
        mDate="$(GetFileInfo -m "$f")"

        SetFile -d "$cDate" -m "$mDate" "${f%.*}.mov"

    fi

done