Change *.txt to *.csv How can I rename all *.txt in a directory to *.csv files in the terminal (Mavericks). I tried following inside the directory:

mv *.txt *.csv
You need to loop over all files

for f in *.txt; do
    mv "$f" "${f%.txt}.csv"
done


If you have files with names starting with a . as well you might need to run

for f in *.txt .*.txt; do
    [[ -f "$f" ]] &amp;&amp; mv "$f" "${f%.txt}.csv"
done