October 20, 2014 at 4:53 am
In Powershell it should be something like this - just change 'c:\' to the top folder you want to query.
Set-Location 'c:\'
Get-ChildItem -Recurse | Where-Object {$_.PSIsContainer -eq $false} | Select-Object Name, Directory, @{n="Size"; e={$_.Length}}, CreationTime, LastWriteTime | Format-Table
You can see if this is any quicker.
However with that many directories & files, I can't see any solution being particularly quick.
October 20, 2014 at 5:59 am
I don't have a lot of knowledge of Powershell.
Is it possible to query a path in another server?
And also, to insert the results into a certain table?
Thank you!
October 20, 2014 at 8:50 am
Yep, just use a UNC path - \\servername\... instead of the local path.
It's a bit more work to insert into a SQL table but thought you could do a speed test first to see if it's feasible performance-wise.
There's an article on this site which will help, it's actually very close to what you're doing so may not need much modification:
That script inserts row by row, but I'd recommend trying the insert row-by-row and all at once to see if there's a performance difference.
October 20, 2014 at 9:46 am
Gazareth (10/20/2014)
Yep, just use a UNC path - \\servername\... instead of the local path.It's a bit more work to insert into a SQL table but thought you could do a speed test first to see if it's feasible performance-wise.
There's an article on this site which will help, it's actually very close to what you're doing so may not need much modification:
That script inserts row by row, but I'd recommend trying the insert row-by-row and all at once to see if there's a performance difference.
Heh... I'm definitely a neophyte when it comes to PoSH. After all this time looking, someone finally came up with a good way to do this using PoSH. The neat thing is, it can all be done auto-magically by calling PoSH from xp_CmdShell. I can't speak for the OP but this certainly will satisfy my requirements. Thank you for your example code and the link.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 21, 2014 at 5:39 am
Jeff Moden (10/20/2014)
Gazareth (10/20/2014)
Yep, just use a UNC path - \\servername\... instead of the local path.It's a bit more work to insert into a SQL table but thought you could do a speed test first to see if it's feasible performance-wise.
There's an article on this site which will help, it's actually very close to what you're doing so may not need much modification:
That script inserts row by row, but I'd recommend trying the insert row-by-row and all at once to see if there's a performance difference.
Heh... I'm definitely a neophyte when it comes to PoSH. After all this time looking, someone finally came up with a good way to do this using PoSH. The neat thing is, it can all be done auto-magically by calling PoSH from xp_CmdShell. I can't speak for the OP but this certainly will satisfy my requirements. Thank you for your example code and the link.
You're very welcome Jeff!
Viewing 5 posts - 16 through 19 (of 19 total)
You must be logged in to reply to this topic. Login to reply