Script to transfer files from a folder based on a trigger
2 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
For the problem below, i think the best solution is some bat script but i wanted to do this is Matlab. is it possible to write a script to achieve below:
Folder A, Folder B and Folder C
Folder C has 100 files marked as txt_1 to txt_100, whenever Folder A has a new file (i am using python to trigger a matlab code that outputs in A)
One file (txt_1) from Folder C should be copied to Folder B ....(for second new file in A, move txt_2 and so on....)
Many thanks in advance
Regards,
1 件のコメント
Mario Malic
2021 年 1 月 18 日
There are many questions that are same as yours, use search tool to find your answer.
回答 (1 件)
Manas Shukla
2022 年 5 月 10 日
As per my understanding of your issue, there are three folders, lest say Folder A, Folder B and Folder C. You want to write a MATLAB script which will copy a file from Folder C, in a systematic order, and paste it into Folder B whenever a new file is added in Folder A. You are using some Python code as trigger. I will bifurcate the workaround.
The first part is to check whether a new file is added to Folder A or not. For this you can refer to the below linked ML Answers Post. Detect New File in a Directory - (mathworks.com)
The second part is to copy a file from Folder C to Folder B. For that you can use the 'copyfile' command. Refer to the below example.
copyfile txt_1 'Folder B'
This will copy a file name 'txt_1' from current folder (i.e. Folder C) and paste it into Folder B. Link to 'copyfile' documentation is also attached here for your reference. Copy file or folder - MATLAB copyfile (mathworks.com)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!