Rename 10000 Text files

1 visualización (últimos 30 días)
Sumit Saha
Sumit Saha el 1 de En. de 2021
Editada: Image Analyst el 1 de En. de 2021
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

Respuestas (1)

Ive J
Ive J el 1 de En. de 2021
files = {'tab1.txt', 'tab2.txt'};
target = replace(files, 'tab', '');
cellfun(@(x, y)movefile(x, y), files, target)
  1 comentario
Image Analyst
Image Analyst el 1 de En. de 2021
Editada: Image Analyst el 1 de En. de 2021
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)

Iniciar sesión para comentar.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by