Skip to content
Advertisement

How to specify the files to overwrite using linux cp command on PHP?

Is it possible to tell to linux cp command which files to overwrite via PHP?

Basically, I have searched the conflicts between the source and the destination folders, asked the user what files to overwrite and put them on an array.

Now I want to copy the files, overwriting only the files on the array.

Advertisement

Answer

Can you not call copy with only those files that need to be overwritten and exclude the files which are not to be copied?

By default cp overwrites the file, you can try the -f (force option) but that should bot be necessary.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement