help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] how to bulk rename files


From: Greg Wooledge
Subject: Re: [Help-bash] how to bulk rename files
Date: Thu, 12 Apr 2012 08:19:41 -0400
User-agent: Mutt/1.4.2.3i

On Thu, Apr 12, 2012 at 11:05:41AM +0800, Clark Wang wrote:
> On Thu, Apr 12, 2012 at 04:54, DJ Mills <address@hidden> wrote:
> > This is a TERRIBLE idea, as attempting to word-split a command
> > substitution will fail horribly on any filenames with spaces (which is
> > very common in Windows), and will attempt pathname expansion on the
> > output. A simple glob should be used, or -exec if find is used.
> 
> A glob expansion may cause the command line to be too long since the OP has
> 2.5 million files?

A glob expansion being passed as an argument list to a command will
fail, yes.  But a glob expansion being used internally as the list
in a bash "for" command will be OK.

for f in *; do
  mv -- "$f" "$f.txt"
done



reply via email to

[Prev in Thread] Current Thread [Next in Thread]