Here is a simple recursive function to display all file-names with full path in folders and sub-folders. You can only run this command in Windows PowerShell available since the release of Windows 7.
Copy the above code and save in .ps1 file.
$folder = "c:\\MyDirectory\\"
Function Upload($item) {
foreach ($i in Get-ChildItem $item)
{
Try
{
if((Get-Item $i.FullName) -is [System.IO.DirectoryInfo]){
Write-Output $i.FullName
Upload($i.FullName)
}else{
Write-Output $i.FullName
}
}catch{
Write-Output $i.FullName
}
}
}
Upload($folder)
Copy the above code and save in .ps1 file.
0 comments :
Post a Comment