Skip to content

Instantly share code, notes, and snippets.

@websploit962
Forked from akost/convert.sh
Created January 19, 2021 14:28
Show Gist options
  • Select an option

  • Save websploit962/1acc3fd339d9863cfd551595981d5c3f to your computer and use it in GitHub Desktop.

Select an option

Save websploit962/1acc3fd339d9863cfd551595981d5c3f 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