Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

powershell read a list of names frmo a file and red in FOR loop

$Dir2 = 'C:UsersAdministratorDesktop	estDir2'
$filenames=Get-Content $Dir2filenamesnoext.csv
foreach ($filename in $filenames) {
$found=$false; 
Get-ChildItem -Path $Dir2 -Recurse | ForEach-Object {if($filename -eq $_.BaseName) {Write-Host 'FILE ' $filename ' Ok' -foregroundcolor green; $found=$true;CONTINUE }$found=$false;} -END {if($found -ne $true){ Write-Host 'FILE ' $filename ' missing in the folder' -foregroundcolor red}}
}
Get-ChildItem -Path $Dir2 -Recurse | ForEach-Object  {$found=$false; foreach ($filename in $filenames) {if($filename -eq $_.BaseName) {Write-Host 'FILE ' $_.BaseName ' was found on the list' -foregroundcolor cyan; $found=$true;BREAK }} if($found -ne $true){ Write-Host 'FILE ' $_.BaseName ' missing on the list of files' -foregroundcolor Magenta} }
Comment

PREVIOUS NEXT
Code Example
Shell :: linux borrar configuracion residual 
Shell :: npm ERR! code ENOENT npm ERR! syscall rename while trying to install npm install react-native-maps --save-exact 
Shell :: install fzf redhat 8 
Shell :: multiple multple copies in cmd 
Shell :: how to edit file in termux 
Php :: php replace space with underscore 
Php :: php console log var_dump 
Php :: tinker not colorful 
Php :: phpmailer utf8 charset encoding 
Php :: print beauty php 
Php :: get templete uri 
Php :: php change date format 
Php :: return last insert id in codeigniter 
Php :: : Unable to locate package php7.4-fpm 
Php :: htaccess post max size 
Php :: Library not loaded: /usr/local/opt/icu4c/lib/libicuio.64.dylib Referenced from: /usr/local/bin/php 
Php :: php object to array 
Php :: wp enqueue styles 
Php :: laravel 6 link storage with public 
Php :: laravel route list 
Php :: php artisan migrate create table 
Php :: execute artisan command from route 
Php :: smarty prestashop get language 
Php :: Call to undefined function str_limit() laaravel8 
Php :: get term thumbnail 
Php :: link acf 
Php :: get cart page url in woocommerce 
Php :: twig concat string 
Php :: php find multiple strings in string 
Php :: laravel carbon today date format 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =