copyfile: The system cannot find the path specified

56 次查看(过去 30 天)
I get the follwoing error when using copyfile
The system cannot find the path specified.
I am using the following code
is there anything wrong with the code or is it a some MATLAB bug?


Fangjun Jiang
Fangjun Jiang 2018-5-3
use exist(source,'file') to see if the file exists first. Your source file name contains multiple "." and "-'
  3 个评论
Abhinav 2018-5-3
I see. It worked. I was using mkdir to create the destination folder in a wrong way, that's why destination folder didn't exist. I should have thought about it myself. Thanks a lot!


更多回答(2 个)

HEEKWON LEE 2018-8-10
编辑:Walter Roberson 2018-8-11
I have same issue but little bit differnt.
Copyfile Asource Bdes
But it has appeared message "can noy find file"
Also i was checked exist function.
  1 个评论
Walter Roberson
Walter Roberson 2018-8-11
You have the wrong syntax for Asource. You are using remote file naming, which requires the general form
You have the server,, but then you skip the share and path and go directly to the file a.png
It is not really clear that copyfile supports remote file naming.
In any case you need
copyfile(Asource, Bdes)
Your current command is the same as
copyfile('Asource', 'Bdes')


Hussein A A
Hussein A A 2023-6-5
Matlab code is case sensitive, so make sure about the exact spelling within your OS. Moreover, you can try loading or reading and writing of such path into the source and destination file Use fprintf is another alternative
  1 个评论
Walter Roberson
Walter Roberson 2023-6-5
MATLAB code is case-sensitive, but the question has to do with difficulty with files . Whether any particular file name is case sensitive or not depends upon the way the particular file system is configured.
By default, NTFS (Windows) and HFS+ (MacOS) and APFS (MacOS) are not case-sensitive file systems, but all three of those can be configured as case-sensitive.
(Apparently these days on Windows 10 you can enable case sensitivity for individual folders; )



Help CenterFile Exchange 中查找有关 Programming Utilities 的更多信息



Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by