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
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
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: http://en.wikipedia.org/wiki/Man_page
A very simple way to do that is :
if you want to keep current extension:
for i in *; do mv $i ${i}.zip; done
if you want to replace current extension:
for i in *; do mv $i ${i%.*}.zip; done
This should do the trick:
mmv "./*" "./#1.zip"
(Although I have no idea why you would want to do this...)