This is a statement in my shell script. ${origin} and ${archive} are 2 directories.
The command reads all jpg, png and jpeg files within the ${origin} folder and copy them to ${archive} folder.
find ${origin} -regex '.*\(jpg\|png\|jpeg\)' -exec cp -n {} ${archive} \;
What I want is that if cp successfully copy a file, ( also indicates that the file does not exist in ${archive} folder), it will execute some commands.
Questions:
-
How can I know whether cp successfully copy the file, in the shell script?
-
Where can I place the if statement?
Aucun commentaire:
Enregistrer un commentaire