Case-sensitive file move
Show older comments
Is it possible to rename a file if the only difference between the old and new names is the case? A command such as
movefile('test.txt','Test.txt')
returns the error
Cannot copy or move a file or directory onto itself.
I'm making a GUI with the option to rename files, and while being able to do case-sensitive moves like that is not essential, it would certainly be nice.
Accepted Answer
More Answers (1)
Vaibhav Awale
on 11 Jan 2016
0 votes
Hi,
The command;
>> movefile('test.txt','Test.txt')
makes a copy of the original file and then removes the original file. Now both files are located in the same folder and Windows systems are not case sensitive with respect to file names. Hence MATLAB throws an error saying "Cannot copy or move a file or directory onto itself."
Regards,
Vaibhav Awale
Categories
Find more on File Operations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!