movefile permission denied?
Mostra commenti meno recenti
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 Commento
Walter Roberson
il 7 Lug 2016
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.
Risposte (0)
Categorie
Scopri di più su Introduction to Installation and Licensing in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!