Tech Off Post

Single Post Permalink

View Thread: add the remote folder i'm in to the filename, batchfile
  • User profile image
    Jaz

    @Jaz:FECK ME

     

    1,2,3 |
    foreach { 
        $count = $_;
        gci -Path \\myserver-web$count\d$\IISLogs\ -include *.log -recurse | % { $dirName = $_.directoryname; $logname = $_.Name; $_ | Copy-Item -Destination $("D:\ServerLogsAndBackups\IIS\w"+$count+"\"+$dirname+"_"+$logName) -whatif }
    }