"CP - R" command causes file error after copying the file on the command line

1、download tar.gz package from oracle office web site:

$> wget

2、unzip file use command "tar -zxvf jdk-17_macos-aarch64_bin.tar.gz"

$> tar -zxvf jdk-17_macos-aarch64_bin.tar.gz

3、copy jdk-17.0.1.jdk directory to another file directory then use file comparison tool it can show difference the file.

$> cp -r jdk-17.0.1.jdk /opt/java/

in my mind copy a file or a file directory, the original file will be same with new file , but the command "copy -r" is not work well in terminal. attach picture that is compare the file berfore copy and after copy.

i make the same operitation at interal core computer, the command "cp -r" is work well. this may be the M1 core proecess unit is work errror.



[Link Edited by Moderator]


MacBook Pro 14″, macOS 12.1

Posted on Jan 19, 2022 5:48 PM

Reply
Question marked as Top-ranking reply

Posted on Jan 20, 2022 7:15 PM

The moderators removed the link. Post the screenshot using the "Image Insertion" tool on the forum editing window toolbar (it looks like a picture of two mountains and the sun --- second icon from the right). I personally prefer seeing pictures inline than accessing third party websites. Plus when users stumble across your post here later on those inline pictures will still be visible while any items stored and linked to third party websites may no longer be accessible.


How did you compare the items? Different tools may be checking a lot more than just the file's contents. Also you may want to add the "-p" option (lower case "P") to preserve file/folder permissions when using "cp".


What file system(s) are used at the location you are extracting the items and also at the destination when copied?


Similar questions

5 replies
Question marked as Top-ranking reply

Jan 20, 2022 7:15 PM in response to willWang_1024

The moderators removed the link. Post the screenshot using the "Image Insertion" tool on the forum editing window toolbar (it looks like a picture of two mountains and the sun --- second icon from the right). I personally prefer seeing pictures inline than accessing third party websites. Plus when users stumble across your post here later on those inline pictures will still be visible while any items stored and linked to third party websites may no longer be accessible.


How did you compare the items? Different tools may be checking a lot more than just the file's contents. Also you may want to add the "-p" option (lower case "P") to preserve file/folder permissions when using "cp".


What file system(s) are used at the location you are extracting the items and also at the destination when copied?


Jan 21, 2022 7:11 AM in response to HWTech

I use beyond compare tools to compare folder the compare result picture like up picture, the LICENCE file is error. or just unzip the file and then cp the folder to other folder , use ls -l you can find the different like the affter picture:

the first stap: download file and unzip file

the second stap: use ls -l to watch the file(the LICENCE is a soft link file)

the third stap:mkdir testFile then cp -r jdk-17.0.2 testFile then use ls -l to watch the file(now the LICENCE file not is soft link file at all, it is a file. now if we config the JAVA_HOME=~/testFile/jdk-17.0.2, it can not work well )

the last is fail picture:

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

"CP - R" command causes file error after copying the file on the command line

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.