I have to print all the directories and all the files. But If I find a directory I have to "enter to the directory" and print the files stored in that directory. It only have two levels, the first level is full fo directorys and the second level there are files.
I've tried this but, it doesn't enter to the directory, it all the directorys two times
$correcte = $args.Count
if ($correcte -lt 1){
forEach ($item in (Get-ChildItem)){ //first level of directories
if($item.PSIsContainer){
forEach ($item in (Get-ChildItem)){
write-host $item //this should print the file inside the directory
}
}
}
}
else{
write-host "You don't have to pass any parameter"
}