3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PowerShell の Get-ChildItem の -Filter の挙動

Posted at

PowerShell の Get-ChildItem で以下のようにすると、余計なファイルがヒットする。

PS C:\foo> Get-ChildItem -Filter *.htm


    ディレクトリ: C:\foo


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       2016/09/30      0:22              0 file1.htm
-a----       2016/09/30      0:22              0 file2.html ← 余計なファイル

以下の場合はヒットしない。

PS C:\foo> Get-ChildItem *.htm


    ディレクトリ: C:\foo


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       2016/09/30      0:22              0 file1.htm

ちょっと調べて、Get-ChildItem の -Filter は MS-DOS の挙動に合わせている、と理解。

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?