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?

More than 1 year has passed since last update.

New-Item で新規フォルダ作成しようとした

Last updated at Posted at 2023-03-25

背景

powershellで新規フォルダを作成しようとしました。
すると、、、

New-Item ./ -Type Directory
New-Item: An item with the specified name /Users/apple/powershell already exists.

エラー文を読むとフォルダが既にある、、、?

どうやら名前を指定していないのがまずいみたいです。

名前オプションをつけて解決

そこで名前を指定するオプション(-Name)を追加しました。

New-Item ./ -Name ssss -Type Directory

UnixMode   User             Group                 LastWriteTime           Size
--------   ----             -----                 -------------           ----
drwxr-xr-x xxxx             xxxxx              yyyy/mm/dd hh:mm             xx

成功です。「ssss」という名前の新規フォルダができました。
なおUnixModeの下の表記の意味は以下の通りです。

先頭の1桁:ファイルの種類(今回はDだからフォルダ・ディレクトリ)
2~4桁:所有者の権限
5~7桁:グループの権限
8~10桁:その他ユーザーの権限

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?