Hello everyone I need to replicate a file named " denymove.txt" into all the top level folders within a directory.
I have tried to use the powershell script below but it seem to replicate the file into all the needed first lvl directories and then further down into all subdirectories of those folders as well, which I do not want to happen. If anyone could give me some advice that would be great.
I just need the file copied into all the top level folders within Data, but not into the subdirectories of those.
Powershell
1 2 3 4 5 6 | $file="C:\yourfile.txt"$dir="C:\Data\"#Store in sub directoriesdir$dir-recurse|%{copy$file-destination$_.FullName}#Store in the directorycopy$file-destination$dir |
*edited for Code*