LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 04-19-2006, 01:14 PM   #1
yuccabrevifolia
LQ Newbie
 
Registered: Apr 2006
Location: Tehachapi, CA
Distribution: SuSE 10/Edubuntu
Posts: 1

Rep: Reputation: 0
Replacing characters in file names?


Hi Folks!

First time post please bear with me. I'm using a SUSE 10.1 Beta install and a FirstClass (email) client to back up messages and attachments. The FirstClass Linux 8.090 version has a lot better export functionality in some areas than the Windows counterpart and I'm hoping to use it as a good intro to Linux for some of the Windows oriented people here. I have a problem with the way FirstClass exports and I was hoping someone might be able to help me think through the solution.

Firstclass exports email messages to RTF files. The name of the generated files contain the email address in quotes: “blipdy Blop”37.rtf for instance.

Of course when I write these to a CD and take it over to a Windows machine, the OS will not load or transfer the files because of what Windows sees as an illegal filename. I need to come up with some batch method of stripping out all of the quotes from the filenames within a directory. In some cases people will be backing up hundreds of files at a time so it can't really be done manually. My scripting skills are limited and out of date Javascript and DOS batch files. Can anyone point me in the direction of either an existing utility or a batch file tutorial that could help me do this? I've seen scripts that do global replacement within files, but nothing that renames files. Is there some obvious fix I am missing? FirstClass does not allow the ability to customize the naming conventions.

Any help would be appreciated! TIA!
 
Old 04-19-2006, 01:31 PM   #2
Tuatha
LQ Newbie
 
Registered: Apr 2006
Posts: 5

Rep: Reputation: 0
if you just want to strip out quotes use something like this:

for FILE in $(ls -1 *.rtf); do
NEWFILE=$(echo $FILE | sed 's/"//g')
mv $FILE $NEWFILE
done

If that isn't quite what you want then reply & I'll fine tune it for you. SG
 
  


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
BIND9 reject characters in host names jlinkels Linux - Software 1 02-10-2006 10:00 AM
Can i limit new file names created to 8 characters with samba ? amitsharma_26 Linux - Networking 1 12-16-2005 05:42 AM
rename file names with " ? characters fishbonz Linux - Newbie 2 05-31-2005 11:20 AM
replacing single quotes in file names adenardo Linux - General 2 05-27-2005 11:29 AM
replacing characters in a file with others pcdude Linux - General 6 01-19-2005 12:29 AM


All times are GMT -5. The time now is 07:44 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