Skip to content

*-Item should handle files with wildcard characters #2799

@JamesWTruher

Description

@JamesWTruher

Steps to reproduce

Describe "Rename-Item" {
    It "Rename-Item should work with files which have special characters" {
        $file = new-item -itemtype file "${TESTDRIVE}/file[txt].txt"
        test-path -literal $file.fullname | Should be $true
        Rename-Item -literal $file.fullname "${TESTDRIVE}/file.txt.txt"
        test-path -literal $file.fullname | Should be $false
        test-path -literal "${TESTDRIVE}/file.txt.txt" | should be $true
    }
}

Expected behavior

this test should pass (and it does on Windows)

Actual behavior

Rename-Item can't seem to find the file

Describing Rename-Item
 [-] Rename-Item should work with files which have special characters 1.41s
   An object at the specified path /tmp/bc945451-748f-471e-8dab-f2d09a1b2221/file[txt].txt does not exist.
   at line: 5 in /home/james/tmp/rename.item.tests.ps1
Tests completed in 1.41s
Passed: 0 Failed: 1 Skipped: 0 Pending: 0

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.0.0-alpha
PSEdition                      Core
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   3.0.0.0
GitCommitId                    v6.0.0-alpha.13-10-g7015e66baecc02955640b5c19e7feb5cb6746c63
CLRVersion
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
uname -a
Linux jimtru-ub16d 4.4.0-47-generic #68-Ubuntu SMP Wed Oct 26 19:39:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productOS-LinuxResolution-FixedThe issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtime

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions