Updating copy command to use recursion