In Matlab for Mac, I am trying to move file A into folder B, as follows. I have already created the necessary file name (variable A) and the destination path (variable B), which I echo in the command window for your convenience. (The string "myusername" is not my actual username, but you probably suspected that.) Thus:
>> A
A = /Users/myusername/Desktop/OldMacHDD_bkup/recup_dir.1/t2342720.jpg
>> B
B = /Users/myusername/Desktop/OldMacHDD_bkup/jpg/
>> movefile( A , B , 'f' ) ;
Error using movefile
mv: rename /Users/myusername/Desktop/OldMacHDD_bkup/recup_dir.1/t2342720.jpg to
/Users/myusername/Desktop/OldMacHDD_bkup/jpg/t2342720.jpg: Permission denied
What must I do to give myself permission to move this file? On my Mac, I have already set the Read/Write permissions from/to that folder for all users, but I still get the "Permission Denied" error. Thanks much

댓글 수: 1

Please show
[adir, abase, aext] = fileparts(A);
aname = [abase, aext];
destfile = fullfile(B, aname);
system( sprintf('ls -edn ''%s''', adir) );
system( sprintf('ls -edn ''%s''', A);
system( sprintf('ls -edn ''%s''', B) );
system( sprintf('ls -edn ''%s''', destfile) );
That is, permission can be denied if the destination file does not exist and you do not have write access to the directory, or if the destination file does exist but you do not have write access to it, or if you do not have permission to remove the source file because you do not have write access to the source directory.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

질문:

2016년 7월 7일

댓글:

2016년 7월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by