1

I have a structure with multiple subfolders and I would like to rename the file and (sub)folders by introducing a code with a structure as follows:

1 (folder) 1.1 (subfolder) 1.1.1 (file)

or alternatively attribute a specific name from a CSV. I have tried with

 $csv="path\rename.csv" #path to csv file

$folder= Get-ChildItem "path"-Recurse -File #target folder containing files

cd ($folder); import-csv ($csv)| foreach {rename-item -path $.path -newname $.filename}

but the process is iterative then it stops with errors because in the meanwhile the up-directory has changed name...

Thanks for any help.

UserEC
  • 11

0 Answers0