LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 05-09-2005, 04:02 PM   #1
dbowles
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
done

Thanks,

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

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


Reply


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


All times are GMT -5. The time now is 05:36 AM.

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