$DirVan="C:\BestandVerplaatsen\van\*"
DirNa="C:\BestandVerplaatsen\naar"
#$File = Get-ChildItem C:\BestandVerplaatsen\van\*.* # HELP !! --> this is still an object wich contains an array #I need an object wich contains an item of that array because i need to compare it later with an array i can't compare it #or i don't know how . for example there is a file without an exention. first it should check if directory olso go a file with the same name but with the exentention .xml (based on basename). if it exesits it should copy both files to another direcotry. if it doesn't exist it shoulgive a warning
$File
=???
#HELP how to get an object wich contains one item of the array
echo
"print sfile"
$File
echo
""
#******************************************************************* # Report baseName's #******************************************************************* #echo "basename wordt geplrint"
echo
"print basename of all files"
#get basename all files
$a
=gciC:\BestandVerplaatsen\van\*|% {$_.BaseName}
#$FilenameProper=$_.BaseName
$a
#echo whiteline
echo
""
#get basename xml files
echo
"print basename of .xml files"
$b
=gciC:\BestandVerplaatsen\van\*-filter'*.xml'|% {$_.BaseName}
$b
#******************************************************************* # if files in directory copy to specific place #******************************************************************* foreach
($Filein$DirVan){
$exists=$DirVan|Where-Object {$_.BaseName -eq$_.BaseName}
# Help !!!
#what to fill in here because it needs to compare if there is a file in de directory with the same basename.
# if there is another file with the same basename it should execute some code below
if($exists
) {
# execute code
} }