Rename a folder with files in it

33 Ansichten (letzte 30 Tage)
nicholas tuminello
nicholas tuminello am 19 Mär. 2021
Beantwortet: Cris LaPierre am 19 Mär. 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

Antworten (1)

Cris LaPierre
Cris LaPierre am 19 Mär. 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.

Kategorien

Mehr zu Search Path finden Sie in Help Center und File Exchange

Produkte


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by