简体   繁体   中英

How to improve the speed of directory creation

I am wanting to create around 1000 folders onto a 16GB FAT32 USB but it takes around 1-2 minutes. That seems a little absurd for just directories. Are there any ways to speed this up?

I would look up other things to try but I have found nothing. Changing from FAT32 to NTFS improves speed drastically but unfortunately I cannot use that. Currently I am testing out of powershell running a very basic for loop script to create directories.

for ($i=1;$i -le 1000;$i++){MD "D:\$i"}

Any suggestions on how to improve this?

If you are already in the directory where you want to create the folders, you can simply run the following because the -Path parameter accepts an array.

new-item -itemtype directory -path (1..1000)

If significant time is wasted displaying output to the console, you can use $null to suppress that.

$null = new-item -itemtype directory -path (1..1000)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM