Gaurav Goyal
Gaurav Goyal

Reputation: 39

copy file with destination permission

we use “cp” command to copy files from one location to another. Then, we use “chmod”, and “chown” commands to change the permissions and ownership of a file, respectively. However, we can combine all these tasks into a single one-liner command, and still get the same result instead of running the three consecutive commands. This can be helpful when you want to do this on a regular basis, or within a script. i want this script because i want to 1 file in many folder with destination permission?

Upvotes: 1

Views: 5147

Answers (1)

Akhilesh Joshi
Akhilesh Joshi

Reputation: 362

use --no-preserve to preserve the destination mode/ownership

cp --no-preserve=mode,ownership source_file destination_file

Upvotes: 4

Related Questions