Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

loop through subfolders

Tags:

powershell

Hi I would like to create a batch file to get all the sub-folders.Can anyone please help me on this?

like image 347
Henry_Cornell Avatar asked Aug 03 '12 08:08

Henry_Cornell


1 Answers

This is trivial in both batch files or PowerShell:

Batch:

for /r %%x in (*.sql) do (
    rem "(or whatever)"
    sqlcmd "%%x"
)

PowerShell:

Get-ChildItem -Recurse -Filter *.sql |
    ForEach-Object {
        sqlcmd $_.FullName # or whatever
    }
like image 170
Joey Avatar answered Oct 02 '22 08:10

Joey