#=======================================
$Folder_file_path="D:\test_folder\"
$initCount=0
[array]$data_files = Get-ChildItem $Folder_file_path #get all items and save to array
$i_count=$data_files.count #count items on the array and assign to $i_count variable
Write-Host $initCount #optional to display count value
#if statement to process if files are found
if($data_files.count -gt 0){
#increment for loop from zero to last index of the array
for ($initCount; $initCount -lt $i_count; $initCount++ ) {
#Write-Host "$($data_files.Count) Files found in folder!"
Write-Host ($data_files[$initCount].name ) #display the filename with the extension
Write-Output ($data_files[$initCount].name ) >> d:\Files_list.txt # write data to a text file; ">>" append operator since for loop is used
}
}else{
Write-Host No files in the folder!
}
#=======================================
Change the script folder path to the desired location.
The script above will also list the folder names inside the specified path; if need to get just the filenames then the script needs to be tweaked a little bit.
Script tested on PowerShell version 4.0
================================
Free Android Apps:
Click on links below to find out more:
Linux Android App cheat sheet:
https://play.google.com/store/apps/details?id=com.LinuxMobileKit
https://play.google.com/store/apps/details?id=soulrefresh.beautiful.prayer
Catholic Rosary Guide for Android:
https://play.google.com/store/apps/details?id=com.myrosaryapp
http://quickbytesstuff.blogspot.sg/2014/09/how-to-recite-rosary.html
Divine Mercy Chaplet Guide (A Powerful prayer):
https://play.google.com/store/apps/details?id=com.dmercyapp
Comments
Post a Comment