Monday, April 6, 2020

Create folders from a text file in Powershell with modified date.


$folders = import-csv C:\mycsvfile.csv
cd myfolder

foreach ($f in $folders)
{
     mkdir $f.name
     $path = "C:\myfolder\"+$f.name
     $temp = Get-Item $path
     $temp.LastWriteTime = $f.configvalue
}

Note:  the csv file has to have a column called 'name' to powershell to identify the column.



No comments:

Post a Comment

Thank you for your comment.