Hello there, I need some help with an annoying issue that I can't fix by myself even though I've tried.
So I have 2 folders. In folder 1 there's a .txt file which I've downloaded (it has a random name), and I want to move it into folder 2, but I want to be able to rename it while I do that.
I've used dir in order to get all the files in folder 1, then I got the name of the file that's in it, but when I use copyfile in order to duplicate it into folder 2, I get this error "The filename, directory name, or volume label syntax is incorrect."
Param.folder1='C:\Users...'; Param.folder2='C:\Users...'; Files=dir(Param.folder1); for i=1:length(Files) if((~strcmp(Files(i).name,'.'))&&(~strcmp(Files(i).name,'..'))) NameF=Files(i).name; copyfile(NameF,[Param.folder1,Param.folder2,'rez.txt']); endend
Thank you!
Best Answer