Home Forums Programming Powershell Copy a file from each subdirectory to one folder RE: Copy a file from each subdirectory to one folder

  • Sorry Erik, I saw this on the mobile but you had figured it out by the time I have reached the desktop.

    For those who will read this post and cannot see the difference between Erik's problem and his solution, the solution adds $_ to the copy command (unless I am very much mistaken). $_ is the input to the current command which is the output from the previous command in the pipeline. In this case the output from ls in the solution and would have been the output of Get-ChildItem in the problem.

    For clarity ls is just an alias of Get-ChildItem.

    (Edited to correct heinous crime of misspelling of Erik's name!!!)

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!