Patching File System Trees with PowerShell(tellingmachine.com)
submitted by
Klaus(755) 3 years, 8 months ago
While working on a elaborate PowerShell script I needed to find a solution for the following problem: I wanted to do a string replace operation on a file system path name and have the resulting new string be reflected by the file system. For example the path name "C:\dogs\dog food\my favorites\hot dogs\Who let the dogs out.mp3" should be renamed by replacing "dog" with "cat". The resulting path name would be "C:\cats\cat food\my favorites\hot cats\Who let the cats out.mp3". Sounds easy, but how do I move the folders and files that are referred to in the path to their new locations? And even better, how can I do this recursively? This short blog post demonstrates two possible approaches.
|category: Tips & Tricks
|Views: 3
tags:
Tips another
Everyones tags:
Your Tags: