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 commentaire

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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by