LoginSignup
2
3

More than 5 years have passed since last update.

powershell csvファイルを読み込んでフォルダ作成

Last updated at Posted at 2017-10-22

したいこと:
サーバの移行の際にデータコピーする準備として。
既存フォルダの一覧を作成して、それを基にフォルダ作成する
今回は自宅PCで試作

フォルダのみ検出してCSVファイルに書き出し
PS C:\Users\user\Desktop> Get-ChildItem -Recurse | where{$_.mode -match "d"} | Export-Csv result.csv -Encoding utf8
PS C:\Users\user\Desktop> cd ../

書き出したCSVファイルを元にフォルダを作成
PS C:\Users\user> Import-Csv c:\Users\user\Desktop\result.csv | ForEach-Object{mkdir $_.BaseName}

2
3
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
2
3