Skip to content

Instantly share code, notes, and snippets.

@eugesh
Forked from akost/convert.sh
Created March 4, 2024 15:33
Show Gist options
  • Select an option

  • Save eugesh/055c2d4605c17f8f70ed6826c8d62b00 to your computer and use it in GitHub Desktop.

Select an option

Save eugesh/055c2d4605c17f8f70ed6826c8d62b00 to your computer and use it in GitHub Desktop.

Revisions

  1. @akost akost created this gist Apr 4, 2012.
    15 changes: 15 additions & 0 deletions convert.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/bin/bash

    # Recursive file convertion windows-1251 --> utf-8
    # Place this file in the root of your site, add execute permission and run
    # Converts *.php, *.html, *.css, *.js files.
    # To add file type by extension, e.g. *.cgi, add '-o -name "*.cgi"' to the find command

    find ./ -name "*.php" -o -name "*.html" -o -name "*.css" -o -name "*.js" -type f |
    while read file
    do
    echo " $file"
    mv $file $file.icv
    iconv -f WINDOWS-1251 -t UTF-8 $file.icv > $file
    rm -f $file.icv
    done