Home > Archive > Unix Programming > August 2005 > renaming files
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| junky_fellow@yahoo.co.in 2005-08-23, 7:00 pm |
| I have around 500 files in a directory as *.*.org
I want to rename each of the file by removing .org at the
end.
For eg. I want to rename file 1.test.org ---> 1.test
2.test.org ---> 2.test
and so on.
Does anybody know any such command ?
Thanx for any help in advance...
| |
|
|
| Heiner Steven 2005-08-30, 6:59 pm |
| junky_fellow@yahoo.co.in wrote:
> I have around 500 files in a directory as *.*.org
> I want to rename each of the file by removing .org at the
> end.
> For eg. I want to rename file 1.test.org ---> 1.test
> 2.test.org ---> 2.test
> and so on.
If you have a POSIX shell (ksh, ksh93, zsh, bash), you
can use
for file in *.*.*.org
do
mv "$file" "${file%.org}"
done
Heiner
--
___ _
/ __| |_ _____ _____ _ _ Heiner STEVEN <heiner.steven@nexgo.de>
\__ \ _/ -_) V / -_) ' \ Shell Script Programmers: visit
|___/\__\___|\_/\___|_||_| http://www.shelldorado.com/
|
|
|
|
|