Rename a folder with files in it

33 visualizaciones (últimos 30 días)
nicholas tuminello
nicholas tuminello el 19 de Mzo. de 2021
Respondida: Cris LaPierre el 19 de Mzo. de 2021
Hello, I was trying to rename folder using movefile() function but realised that it only works on empty folders.
Is there anyway to rename this folder with files in it?
oldfolderdir = "c:\temp\oldfoldername_withstuffinit"
newfolderdir = "C:\temp\newfoldername_withstufffrom_oldfoldername"
movefile oldfolder newfolder

Respuestas (1)

Cris LaPierre
Cris LaPierre el 19 de Mzo. de 2021
The movefile function can rename folders with files in them (I just tested on a folder on my computer) but it does depend on the write permissions you have. You can try using the following syntax for locations that are not writable.

Categorías

Más información sobre Search Path en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by