modify code to copy jpg directly in the correct directory