Claus Witt

software and web developer

Archive for the ‘bash oneliner’ tag

Converting Filenames to Lowercase with Bash

without comments

Once again I have a bash-oneliner. For some reason it is all I blog about at the moment.

I had an import script for importing demo files (in mp3 format) to a database used at Voicearchive. Only problem the import script depended on the files being named precisely according to a specific rule. But for some reason some times it was named with uppercase letters, and sometimes with lowercase letters. I decided to rename all files to lowercase, and change the importscript accordingly.

find . -maxdepth 1 -type f -execdir rename 'y/A-Z/a-z/' '{}' \;

Written by Claus Witt

June 3rd, 2009 at 8:24 am

Bash Oneliner for Counting Files

with 2 comments

I needed to find a way to count the number of files in a directory and only output that number. Bash is still my best friend for this sort of thing – especially with a little help from google.

ls -1 | wc -l

by the way – the answer was 2062 files.

Written by Claus Witt

May 14th, 2009 at 10:56 am

Posted in Development

Tagged with , ,