0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ファイルを探すためのメモ

0
Posted at

[powershell][dir][find]

ファイルの検索(powershell)

  • ファイル名で検索
    Get-ChildItem -Path C:\ -Recurse -File -Filter 'target.txt' -ErrorAction SilentlyContinue
    
  • ディレクトリ名で検索
    Get-ChildItem -Path C:\ -Recurse -Directory -Filter 'target' -ErrorAction SilentlyContinue
    
  • ファイルもしくはディレクトリ名の一部で検索
    Get-ChildItem -Path C:\ -Recurse -Filter '*target*' -ErrorAction SilentlyContinue
    
  • ファイル名の一部で検索(正規表現)
    Get-ChildItem -Path C:\ -Recurse -File -Filter '*.pdf' -ErrorAction SilentlyContinue | Where-Object { $_.Name -match 'target' }
    
  • ファイルの作成日で、ファイルを検索
    Get-ChildItem -Path C:\ -Recurse -File -ErrorAction SilentlyContinue | Where-Object { $_.CreationTime.Date -eq [datetime]"2025-07-05" }
    
  • 出力をフルパスのみにする
    ... | Select-Object -ExpandProperty FullName
    

ファイルの検索(cmd.exe)

  • ファイル名で検索
    dir C:\*target* /S /B 
    
  • ファイルの作成日で、ファイルを検索
    dir C:\ /S /TC | findstr "2025/07/05"
    

ファイルの検索(find)

  • ファイル名で検索
    find / -type f -name *target* 2>/dev/null
    
  • ファイルの作成日で、ファイルを検索
    find / -type f -newermt '2025-07-05' ! -newermt '2025-07-06' 2>/dev/null
    

以上です。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?