Rename 10000 Text files

2 ビュー (過去 30 日間)
Sumit Saha
Sumit Saha 2021 年 1 月 1 日
編集済み: Image Analyst 2021 年 1 月 1 日
I've 10000 text file but want to change the name. How can i rename these files ?
example- IND.X0kY0k.HXX.txt to 1.txt like wise for every files

回答 (1 件)

Ive J
Ive J 2021 年 1 月 1 日
files = {'tab1.txt', 'tab2.txt'};
target = replace(files, 'tab', '');
cellfun(@(x, y)movefile(x, y), files, target)
  1 件のコメント
Image Analyst
Image Analyst 2021 年 1 月 1 日
編集済み: Image Analyst 2021 年 1 月 1 日
Did you try
files = {'example- IND.X0kY0k.HXX.txt', 'example- IND.X0kY0k.HXY.txt'};
target = replace(files, '.HXX.txt', '.txt');
% Be careful with others because they'd overwrite the .HXX one.
%target = replace(files, '.HXY.txt', '.txt');
%target = replace(files, '.HXZ.txt', '.txt');
cellfun(@(x, y)movefile(x, y), files, target)

サインインしてコメントする。

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by