[Mi...] Posted December 20, 2024 Share Posted December 20, 2024 (edited) I want to make a parametric program, that I can edit entirely outside of the program... Is there a function that simply will give me all the file names in a directory? Basically, can I read these 3 files and get them in a list? or is this going to be something that needs done with getParameterNamed() and a loop? Edited December 20, 2024 Link to comment Share on other sites More sharing options...
[Ch...] Posted December 20, 2024 Share Posted December 20, 2024 (edited) Im sure these is, I will search when I have some time.. Question : if you're making the parametric program, do you just want to check to make sure these 3 files exist ? fileExists() Is it important for the program to know if there are more files or you just want to check to make sure ? Edited December 20, 2024 Link to comment Share on other sites More sharing options...
[Ch...] Posted December 20, 2024 Share Posted December 20, 2024 Seems there is a way with a batch file or hidden PCM ... https://forums.zeiss.com/messtechnik/community/viewtopic.php?p=58354&hilit=run+bat+file#p58354 Link to comment Share on other sites More sharing options...
[DW...] Posted December 27, 2024 Share Posted December 27, 2024 I am not exactly sure of your needs, but this is a Powershell script that will read the contents of each text file in the folder and then append it into a single text file. Is that what you are trying to do? # Define the directory containing the text files $sourceDirectory = "C:\Path\To\Your\TextFiles" # Define the output file where all contents will be combined $outputFile = "C:\Path\To\Your\CombinedOutput.txt" # Check if the output file already exists and remove it to avoid appending to old data if (Test-Path $outputFile) { Remove-Item $outputFile } # Get all .txt files in the specified directory $textFiles = Get-ChildItem -Path $sourceDirectory -Filter "*.txt" # Loop through each text file and append its content to the output file foreach ($file in $textFiles) { # Read the content of the text file $content = Get-Content -Path $file.FullName # Append the content to the output file Add-Content -Path $outputFile -Value $content # Optionally, add a newline for separation between files Add-Content -Path $outputFile -Value "`n" } Write-Host "All text file contents have been combined into $outputFile" Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in