拡張子のついていないファイルの拡張子をつけたい。
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
「〇〇〇〇.〇〇〇〇.〇〇〇〇」(〇〇の部分はすべて数字)という拡張子のついていないファイルが大量に存在するフォルダがあります。
このフォルダに存在する全てのファイルに.dcmの拡張子をつけたいのですが、どのようなスクリプトを書けばよいでしょうか。
よろしくお願いいたします。
0 commentaires
Réponse acceptée
Kojiro Saito
le 7 Avr 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
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!