Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-09-2005, 04:02 PM   #1
LQ Newbie
Registered: May 2005
Posts: 1

Rep: Reputation: 0
Renaming Multiple Files with a "." on the end of the filename

I am trying to port several thousand files from a linux workstation to a windows workstation. The windows workstation refuses to work with files that have a "." at the end of the filename. I have tried to write a shell script but it does not seem to work. Is there an easier way to remove the "." at the end of the filename or do am I writing my regular expression wrong?

for i in `ls *.`; do
t=`echo i$ | sed 's/\(.*\)/\1/'`
mv $i $t


David B.
Old 05-09-2005, 04:28 PM   #2
Senior Member
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 110Reputation: 110
for i in *. ; do
	t=`echo $i | sed 's/\.$//'`
	mv $i $t
Or, a little smaller and faster, but bash-only:
for i in *. ; do
	mv $i ${i%.}


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
renaming file names beginning with "-" prashln Linux - General 5 05-01-2010 01:47 AM
"Input/output error" on files at end of CD mfeat Linux - Software 2 11-23-2005 02:01 PM
DPKG & "files list file for package `pkg-config' contains empty filename" error :( Angelus Debian 2 04-02-2005 07:34 AM
why iam getting problems like "...too many files opened" or "segmentation fault" naren_0101bits Linux - Newbie 2 07-19-2004 12:20 PM
"X-MS" cant open because "x-Multimedia System" cant access files at "smb&qu ponchy5 Linux - Networking 0 03-29-2004 11:18 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:43 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration