Guest User

source_paths.txt generator 2

a guest
Nov 7th, 2024
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Define the directory path and the text prefix
  2. $directoryPath = "C:\GAMEZ\Red Dead Redemption 2\lml\UpscaledAnimals\Birds\Birds"       # Change this to a directory path of the mod folder that contains only files of the same .rpf
  3. $prefix = "C:\GAMEZ\Red Dead Redemption 2\packs_0.rpf\packs\base\models\metaped_textures_animals.rpf\"      # Change this to the .rpf path (remember to delete the .ytd part if you're copying the path from a file)
  4.  
  5. # Check if the directory exists
  6. if (!(Test-Path -Path $directoryPath)) {
  7.     Write-Host "The directory does not exist: $directoryPath"
  8.     exit
  9. }
  10.  
  11. # Check if the $prefix ends with a backslash and add one if necessary
  12. if (-not ($prefix.EndsWith("\"))) {
  13.     $prefix += "\"
  14. }
  15.  
  16. # Initialize the list to hold the modified file names
  17. $fileList = @()
  18.  
  19. # Get all files in the specified directory
  20. $files = Get-ChildItem -Path $directoryPath -File
  21.  
  22. # Loop through each file and add the prefix
  23. foreach ($file in $files) {
  24.     # Create the formatted entry with prefix
  25.     # Ensure to use the file name instead of the file object
  26.     $entry = "$prefix$file"
  27.     $fileList += $entry
  28. }
  29.  
  30. # Output the result to the console
  31. $fileList
  32.  
  33. # Optionally, save the list to a text file
  34. $outputFilePath = ".\EasySource_paths.txt" # Change to absolute path
  35. $fileList | Out-File -FilePath $outputFilePath  # Change this to your desired output path
  36.  
Advertisement
Add Comment
Please, Sign In to add comment