movefile permission denied?

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 件のコメント

Walter Roberson
Walter Roberson 2016 年 7 月 7 日
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 ExchangeIntroduction 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