Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to add the .zip extension to all files. I tried this, however it does not work:

ls | awk '{print $1 " " $1".zip"}' | xargs mv -f
share|improve this question
up vote 1 down vote accepted

Searching - few links:


    man rename:

    NAME rename - renames multiple files

    SYNOPSIS rename [ -v ] [ -n ] [ -f ] perlexpr [ files ]

    DESCRIPTION "rename" renames the filenames supplied according to the rule specified as the first argument. The perlexpr argument is a Perl expression which is expected to modify the $_ string in Perl for at least some of the filenames specified. If a given filename is not modified by the expression, it will not be renamed. If no filenames are given on the command line, filenames will be read via standard input...

man wiki:

share|improve this answer
thx, based on that I was able to do it like this - ls | xargs -I % mv % – UAdapter Oct 31 '11 at 9:30
for f in * ; do 
  mv "$f" "$"
share|improve this answer

rename 's/$/\.zip/' *

Don't use xargs for that!

share|improve this answer
why don't use xargs? – UAdapter Nov 1 '11 at 14:50
Well - there's just no reason! – Adobe Nov 1 '11 at 15:13

This should do the trick:

mmv "./*" "./"

(Although I have no idea why you would want to do this...)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.