0

I have a situation where I have multiple folders, with the same name, at various places with in a single tree, that need to all have the same set of permissions. These permissions need to be different from thier parent folder. So I need to find all the folders and then rename them.

This is further complicated by the fact that most of the ones I need are too long for a powershell command to find them. When I ran

gci -Filter "Folder Name" -Recurse -Path "D:\x\y\z" -Directory | select-object FullName | Export-Csv C:\Output\folderlist.csv

it returned file name length errors and the resulting file was empty even though when I tried it on a test situation it worked.

I'm just moving into the level of writing these so please excuse my overlooking anything obvious.

  • I'm not sure whether Powershell supports long path format, but try `\\?\D:\x\y\z` as the root directory path. – Harry Johnston Oct 12 '16 at 21:45
  • I know that the problem with the above script is that the locations where I am looking are too long for powershell. I need something that will do the same job, but not in powershell. – D. Schluter Oct 12 '16 at 22:16
  • 1
    [Related](http://stackoverflow.com/a/38997646/1630171). – Ansgar Wiechers Oct 12 '16 at 22:18
  • 1
    The path length limitation is in Windows, not in Powershell. You'll need to use the long path format no matter what language you're using. Unfortunately it does look like Powershell won't accept long path format, it complains about "illegal characters". – Harry Johnston Oct 12 '16 at 22:39
  • 1
    Related ways to work around long paths in PowerShell: http://stackoverflow.com/questions/35654154/psdrive-path-still-too-long and http://stackoverflow.com/questions/34812349/how-can-i-query-a-temporary-ps-drive-while-returning-files-with-a-name-relative – TessellatingHeckler Oct 12 '16 at 22:52

0 Answers0