PowerShell script to append filenames

Home Forums DeepFaceLab Extract Images PowerShell script to append filenames

Viewing 1 post (of 1 total)
  • Author
  • #7915

      This is a simple script to append characters to be beginning of your filenames. Very useful for keeping faceset sources separated.

      Step 1: Open Windows PowerShell.

      Step 2: Navigate to the image folder. Examples:

      cd "C:\DeepFaceLab\DeepFaceLab_NVIDIA_RTX3000_series\workspace\data_src"
      cd "C:\DeepFaceLab\DeepFaceLab_NVIDIA_RTX3000_series\workspace\data_src\aligned"

      Step 3: Copy this script. You may want to save this in a text file for later use.
      Get-ChildItem *.* -Exclude "XXX_*" | where { ! $_.PSIsContainer } | rename-item -NewName { "XXX_" + $_.Name }

      Step 4: Change both instances of “XXX_” to whatever you want to append. Keep it short.

      Step 5: Paste script into PowerShell and hit Enter. Done.

      Script Explained:
      This script will loop through all files (not folders) in the current directory and append XXX_ to the beginning of all filenames. In order to avoid an infinite loop the script checks for the appended name first. Make sure to change both XXX_ near the beginning and the end.

      Every aligned faceset file takes its name from the parent frame or image.
      If you rename your extracted frames or images before extracting the faceset then the filename will cross over to the faceset. You can recover the original filename at any time and it will be the appended filename.
      If you rename your faceset files after extraction (or ones you have downloaded) then the name will not be permanent. If you use the recover original filename script all files will revert to their original parent frame filename and you will lose the appended filename.

    Viewing 1 post (of 1 total)
    • You must be logged in to reply to this topic.