• Login
Community
  • Login

batch execution

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 3 Posters 908 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.
  • M
    Manfred Humphries
    last edited by Mar 26, 2021, 9:03 PM

    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?

    A M 2 Replies Last reply Mar 26, 2021, 9:05 PM Reply Quote 0
    • A
      Alan Kilborn @Manfred Humphries
      last edited by Mar 26, 2021, 9:05 PM

      @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
      • M
        Michael Vincent @Manfred Humphries
        last edited by Michael Vincent Mar 26, 2021, 9:20 PM Mar 26, 2021, 9:18 PM

        @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
        • M
          Manfred Humphries
          last edited by Mar 26, 2021, 11:24 PM

          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
          3 out of 4
          • First post
            3/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors