Error using copyfile to make a backup of a folder on my desktop

13 views (last 30 days)
I have been running a script that copies a file called "All Files" from my desktop to a different storage device directory. It has worked 40-50 times in the past. It utilizes the copyfile function in MATLAB. The relavent line of code reads:
[ SUCCESS,MESSAGE,MESSAGEID ] = copyfile(AllFilesDirectory,...
AllFilesBackupDirectory,...
'f')
Recently, instead of a successful copying of the file contents, I get
SUCCESS =
logical
0
MESSAGE =
'Unknown error occurred.'
MESSAGEID =
'MATLAB:COPYFILE:OSError'
The only thing that has changed is that I am continually adding new content to this folder. However, I have been doing so since I made the folder and began backing it up, so this is nothing new.
Edit: In case it is relevant, the folder is about 50 GB right now.
  1 Comment
Michal Dobai
Michal Dobai on 7 Dec 2017
OK, I'm not sure if this can help you, but I'm getting exception with same ID when I'm trying to copy and replace the file used by another process (in my case opened excel file).
I know it's different type of error, but I was thinking if you call copyfile without output arguments it apparently throws an exception instead of error code and message. You will then can see stack trace, which could help you understand your problem.
Or another idea: If you can reproduce the problem, maybe you can try to copy file manually at the same time you getting error. Maybe same error will occur and your OS will give you more information. :)

Sign in to comment.

Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!