Rename A Lot of Files
Afficher commentaires plus anciens
Hello, can anyone tell me how to rename a lot of files? I have a problem because my files name have a type like this (YR.ME01..HHZ.D.2013.280.000000.SAC), but I need it to be like this (2013.280.00.00.00.000.YR.ME01.BHZ.SAC). Thank you for your help.
Réponses (1)
Adam
le 24 Juin 2015
movefile('source','destination')
doc movefile
works for renaming a file. If it is in the current folder you can just put old and new filenames, otherwise you also have to add the path.
To rename a lot of files just do it in a loop. It depends where you are getting the names from how best to do that though. If it is all files in a folder you can use
doc dir
and query its results for filenames of the required format then write a function that takes an old name and converts it to a new name, then call it on all your files, using movefile as above to save each one.
1 commentaire
Stephen23
le 24 Juin 2015
Catégories
En savoir plus sur File Operations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!