none
Loosing file extension RRS feed

  • Question


  • I scripting in Powershell 2.0


    I'm using (symplified) code:

    $xx = get-childitem -filter "testfile.txt"

    $xx.copyto("c:\bak\testfile.txt")  - also tried MoveTo

    I don't get any errors/exceptios

    When I check the folder 'C:\BAK' I only find the file "testfile" w/o an extension.

    I can't figure out what I'm doing wrong - any help would be greatly appreciated. 

    Tuesday, August 9, 2016 8:36 PM

Answers

All replies

  • ?


    PS C:\> Copy-Item "testfile.txt" "c:\bak"

    That's all you need to do.


    -- Bill Stewart [Bill_Stewart]

    Tuesday, August 9, 2016 8:39 PM
    Moderator
  • THX - that worked!

    Still, I am curious why CopyTo(MoveTo) does not carry the file extension to the target.

    Tuesday, August 9, 2016 10:49 PM