How can I copy multiple files to another folder than current folder?

조회 수: 5 (최근 30일)
Elien Bellon
Elien Bellon 2018년 11월 2일
편집: Elien Bellon 2018년 11월 2일
Hi, I want to move multiple txt files (all starting with rp_aS) to another folder than the current folder of the files (not a subfolder). If I use destdir = [path where I want my files to go]
copyfile rp_aS* destdir
matlab makes a new subfolder called destdir in my current folder. How do I copy all these files to another folder outside of the current folder (i.e., where destdir refers to).
Thanks in advance!

채택된 답변

awezmm
awezmm 2018년 11월 2일
Try using the fullpath to the new folder. On mac it begins something like /Users/blahblahblah....
  댓글 수: 5
awezmm
awezmm 2018년 11월 2일
편집: awezmm 2018년 11월 2일
First pick where you want all the new folders to save to. Lets say you always want them to always go to the Desktop. And lets say you have already defined your new destdir.
%Get the full path of JUST your desktop
outside_dir = '/Putyour/fullpath/todesktop/inhere'
%To make variable changing full file path
custom_fullpath = fullfile(outside_dir, destdir)
copyfile rp_aS* custom_fullpath
Let me know if you need any more help
Elien Bellon
Elien Bellon 2018년 11월 2일
편집: Elien Bellon 2018년 11월 2일
Oh no, this makes another subfolder named "Custom_fullpath"

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by