I have two arrays with three elements(file name parts) each. I need to join first element of first array and first element of second array and test if is not null and if the combination(file name) exists and like wise i need to do it for other two elements in a same manner.
$file_nameone_array = ( table, chair, comp)
$file_nametwo_array = ( top, leg , cpu)
foreach ($input_file in $file_nameone_array) {
foreach ($input_rev in $file_nametwo_array) {
$path = "D:\$input_file-$input_rev.txt"
If (test-path $path -pathtype leaf) {
write-host "$path exists and not null"}
else{
write-host "$path doesnot exist"
exit 1}
I expect to test for "table-top.txt", "chair-leg.txt" , "comp-cpu.txt" whereas my code checks for "table-leg.txt" and exits saying table-leg.txt doesnot exist.
@