Welcome to mirror list, hosted at ThFree Co, Russian Federation.

unix2dos.py - github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7a8ca956b86337bde366e98a478f8929f7876da3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env python
import sys

for fname in sys.argv[1:]:
    with open(fname, 'rb') as infile:
        instr = infile.read()

    outstr = instr.replace( b"\r\n", b"\n" ).replace( b"\r", b"\n" ).replace( b"\n", b"\r\n" )

    if len(outstr) == len(instr):
        continue
    
    with open( fname, "wb" ) as outfile:
        outfile.write( outstr )