MATLAB: Copyfile: The system cannot find the path specified

copyfileMATLAB

I get the follwoing error when using copyfile
The system cannot find the path specified.
I am using the following code
source='D:\Research\Thesis_work\Structural_uncertainty\data_collection\Precipitation\precip_hourly\p_39.3130_-87.3130.txt'
destination='D:\Research\Thesis_work\Structural_uncertainty\MatLab_codes\20180222\huc_0512011115\rainfall_data_hourly\p1.txt'
copyfile(source,destination)
is there anything wrong with the code or is it a some MATLAB bug?

Best Answer

use exist(source,'file') to see if the file exists first. Your source file name contains multiple "." and "-'