A
A
alex stephen2015-05-15 11:43:23
linux
alex stephen, 2015-05-15 11:43:23

How to quickly make the contents of all files in a folder lowercase?

Subject.
There is a folder with tons of files, <130kb each.
You need to quickly bypass them all and make them in lower case.
As an option, write a Python script, but the fastest option is still interesting.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
alex stephen, 2015-05-15
@berezuev

import sys

filename = sys.argv[1]
with open(filename, "r+") as f:
    data = f.read()
    f.truncate()
    f.seek(0)
    f.write(data.lower())

in short, I already did it myself)

X
xibir, 2015-05-15
@xibir

I don’t know about thousands, but just convert to lowercase:

#!/bin/bash
cd <ваша папка>
files=`find | sed 1d`
for f in $files; do
   #echo mv $f "${f,,}"
   mv $f "${f,,}"
done

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question