Hi,
I have files like B00001.im7 ..... B10000.im7 inside the particular folder, Here, I intend to replace 'B' by 'P'
for e.x. B00001.im7 to P00001.im7. Please suggest the way to do this..

 Akzeptierte Antwort

Mario Malic
Mario Malic am 21 Sep. 2020
Bearbeitet: Mario Malic am 21 Sep. 2020

0 Stimmen

movefile 'B00001.im7' 'P00001.im7' % or supply full path to the files

5 Kommentare

Turbulence Analysis
Turbulence Analysis am 21 Sep. 2020
Actually, I need to reame the file name inside the folder.
Mario Malic
Mario Malic am 21 Sep. 2020
Bearbeitet: Mario Malic am 21 Sep. 2020
if the source and destination are the same, file will be renamed.
If the files are in your current directory, just provide their names to rename.
Turbulence Analysis
Turbulence Analysis am 21 Sep. 2020
Thanks ,, It worked. But I have 10000 files files from B00001.im7 to B10000.im7, How to implement this.. ??
Mario Malic
Mario Malic am 21 Sep. 2020
Bearbeitet: Mario Malic am 21 Sep. 2020
This should do it.
Dir_files = dir('*.im7');
List_Files = {Dir_files.name}'; % Cell (length(Dir_files, 1) that contain filenames
List_Files(:,2) = List_Files(:,1); % Copying cells to second column
for ii = 1:length(List_Files)
List_Files{ii,2}(1) = 'P'; % Change first character in 2nd column of each file
movefile (List_Files{ii,1}, List_Files{ii,2});
end
Turbulence Analysis
Turbulence Analysis am 21 Sep. 2020
Thanks a lot. It worked perfectly...

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Community Treasure Hunt

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

Start Hunting!

Translated by