What is the use of -recurse in powershell?

Shahpari

Sorry it's probably a dumb question: what is the difference between

Remove-Item -recurse -Force -Verbose and Remove-Item -Force -Verbose

it seems if we use -recurse for a folder and subfolders powershell delete file one by one inside the folder. and if we remove the -recurse powershell simply delete the main folder without checking inside the folder. technically isn't script will run faster without -recurse?

Lee_Dailey

when you use Remove-Item on a dir tree that holds files ... and do NOT use -Recurse, you will get the standard confirmation prompt. so using that parameter makes it run without the delay from the "do you really want to do this?" prompt.

this is one of the reasons that some folks prefer to pipe the output of Get-ChildItem to Remove-Item.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Powershell - directreports -recurse

recurse through powershell object

FileStatus use to recurse directory

Reset Filenumber for new folder in Recurse Filerename Powershell

Powershell -Recurse Parameter; How to exclude specific subdirectory

Adding a -Recurse option to my powershell script

Powershell - Get-ChildItems -recurse not working

What's the proper way to recurse in LLVM assembly?

What use cases are there for add-history in Powershell?

What is the use of the .\ while executing python code in powershell

Option -recurse sometimes does not work for PowerShell cmdlet get-childitem

How to recurse through a directory tree to find files with Powershell

Powershell Get -ChildItem: filtering csv files and -Recurse not working

How to find a file which contains characters and extension in recurse mode in Powershell?

Powershell Copy-Item -recurse does not pick up new directory

PowerShell command pipe line that will pause during get-Childitem -Recurse

How to use result of FILE(GLOB_RECURSE) in EXECUTE_PROCESS?

How to use cmake GLOB_RECURSE for only some subdirectories

Tidy can’t use matches with recurse 0, false, or undef

In Powershell, what kind of data type is [string[]] and when would you use it?

What is the difference between @() and @{} in Powershell and when to use one over another?

What is the correct Date Format String for Month DD, YYYY to use in Powershell

What are _Base properties in Powershell and how do I use them?

What command should I use for getting comprehensive service information on Powershell?

Powershell: recurse directories for where a file extension exists if Exist write out comman if not run a command

PowerShell Get-ChildItem on folder that does not exist behaves different with the -recurse flag

C# equivalent of powershell get-childitem -recurse while omitting certain folders

find and recurse

What are the drawbacks to setting git's submodule.recurse config option to true?