[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] how to bulk rename files
From: |
Conrad J. Sabatier |
Subject: |
Re: [Help-bash] how to bulk rename files |
Date: |
Sat, 21 Apr 2012 19:55:52 +0000 (UTC) |
User-agent: |
Pan/0.135 (Tomorrow I'll Wake Up and Scald Myself with Tea; GIT 30dc37b master) |
On Wed, 11 Apr 2012 15:44:26 -0500, lxnf98mm-Re5JQEeQqe8AvxtiuMwx3w wrote:
> I have many files, 2.5 million, that I have to make available to Windows
> folks They demand that the files have a extension added Is there an
> efficient method of bulk renaming files
>
> Richard
My instinctive response to this question would be to use the find
command, or perhaps a list of filenames that you've already generated
somehow.
First case:
find <root-dir-of-search> -type f -name "*some-pattern*" -print0 |
xargs -0 -I@ mv "@" "@.ext"
or
find <root-dir-of-search> -type f -name "*some-pattern*" |
while read
do
mv "$REPLY" "$REPLY.ext"
done
Sometimes, it seems, using the while loop instead of xargs is faster.
Second case:
while read
do
mv "$REPLY" "$REPLY.ext"
done < file-list
Of course, there are other ways, but these are my most commonly used
idioms.
--
Conrad J. Sabatier
address@hidden
- Re: [Help-bash] how to bulk rename files, (continued)
- Re: [Help-bash] how to bulk rename files, DJ Mills, 2012/04/11
- Re: [Help-bash] how to bulk rename files, Clark Wang, 2012/04/12
- Re: [Help-bash] how to bulk rename files, Greg Wooledge, 2012/04/12
- Re: [Help-bash] how to bulk rename files, Stephane Chazelas, 2012/04/12
- Re: [Help-bash] how to bulk rename files, Greg Wooledge, 2012/04/12
- Re: [Help-bash] how to bulk rename files, lxnf98mm, 2012/04/12
- Re: [Help-bash] how to bulk rename files, Chet Ramey, 2012/04/12
Re: [Help-bash] how to bulk rename files, DJ Mills, 2012/04/11
Re: [Help-bash] how to bulk rename files, Steven W. Orr, 2012/04/12
Re: [Help-bash] how to bulk rename files,
Conrad J. Sabatier <=
Re: [Help-bash] how to bulk rename files, DJ Mills, 2012/04/12