拡張子のついていないファイルの拡張子をつけたい。
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
「〇〇〇〇.〇〇〇〇.〇〇〇〇」(〇〇の部分はすべて数字)という拡張子のついていないファイルが大量に存在するフォルダがあります。
このフォルダに存在する全てのファイルに.dcmの拡張子をつけたいのですが、どのようなスクリプトを書けばよいでしょうか。
よろしくお願いいたします。
0 Kommentare
Akzeptierte Antwort
Kojiro Saito
am 7 Apr. 2023
imageフォルダーに「〇〇〇〇.〇〇〇〇.〇〇〇〇」のファイルがあると仮定し、全て「〇〇〇〇.〇〇〇〇.〇〇〇〇.dcm」にリネームするサンプルは以下のとおりです。
list = dir("image/*");
list([list.isdir]) = []; % リストから'.'と'..'を削除
for n=1:length(list)
movefile(fullfile(list(n).folder, list(n).name), fullfile(list(n).folder, list(n).name + ".dcm"));
end
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!