Community
    • Login

    batch execution

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 890 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Manfred HumphriesM
      Manfred Humphries
      last edited by

      I would like to step thru a directory of 500 files,
      open a file,
      convert it to UTF-8,
      save the file then close it,
      repeat for the next file.
      Any ideas?

      Alan KilbornA Michael VincentM 2 Replies Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Manfred Humphries
        last edited by

        @Manfred-Humphries

        Maybe some ideas HERE as someone yesterday seemed to be trying to do a very similar thing.

        But… encoding detection in Notepad++ is just a guess, not an absolute, so you might detect some files wrongly.
        I don’t know…sounds dangerous to me…

        1 Reply Last reply Reply Quote 1
        • Michael VincentM
          Michael Vincent @Manfred Humphries
          last edited by Michael Vincent

          @Manfred-Humphries said in batch execution:

          would like to step thru a directory of 500 files,
          open a file,
          convert it to UTF-8,
          save the file then close it,
          repeat for the next file.

          Why would you use Notepad++ for this?

          Second hit on Google “powershell convert file to utf-8”:
          https://superuser.com/questions/1163753/converting-text-file-to-utf-8-on-windows-command-prompt

          Get-Content .\test.txt | Set-Content -Encoding utf8 test-utf8.txt
          

          Next, Google “loop through files in directory powershell”. Seems like:

          Get-ChildItem "FULL_PATH_TO_DIRECTORY_WITH_ALL_YOUR_FILES" | Foreach-Object { Get-Content $_ | Set-Content -Encoding utf8 $_.utf8}
          

          Then all your *.utf8 files can be filtered / moved / copied whereever.

          I MAKE NO GUARANTEES THIS WORKS!!! PROBABLY MAKES SENSE TO COPY YOUR 500 FILE FOLDER BEFORE STARTING AND THEN OPERATE ON THE COPY JUST IN CASE!!!

          Cheers.

          1 Reply Last reply Reply Quote 2
          • Manfred HumphriesM
            Manfred Humphries
            last edited by

            I used to write batch files and coldfusin apps, but that was long ago and far from my present mental haze… Thanks, but it looks like I’m going to load and save each file.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors