Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
> Windows to Linux server conversion, Uppercase to lowercase
Jude
post Jun 23 2009, 07:27 AM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 5
Joined: 23-June 09
Member No.: 14,517



I hope this is not a beaten horse, but I cannot seem to find any information about it online...

...recently a friend moved his site from a windows server to a linux one based on the recommendation of his new shopping cart. The problem is that when he put his site together, many years ago, he used capital letters in the names of his directories and filenames. This is now causing tons and tons of broken links. Is ther a program or technique known that can help with this? Is the only option to go through all the lines of code manually changing upcase names to lowercase?

Any assistance is appreciated.

Go to the top of the page
 
+Quote Post
 
Start new topic
Replies
michaelk
post Jun 24 2009, 09:33 AM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,797
Joined: 23-January 03
Member No.: 360



for i in $(ls *.whatever); do sed 's/oldstring/newstring/g' $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done

Basically this command will iterate the current directory for every file that matches *.whatever, replaces oldstring with newstring and creates a new file called filename-tmp
The original file filename is saved as filename-backup and the revised filename-tmp is renamed filename. Best to check this on some test files in a seperate directory.

Without knowing the distribution/version I assume your using bash. You can do this multiple times if there are more then one line that requires modification
Using a text editor.

#!/bin/bash
forfor i in $(ls *.whatever); do sed 's/oldstring/newstring/g' $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done
for i in $(ls *.whatever); do sed 's/oldstring1/newstring1/g' $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done
Go to the top of the page
 
+Quote Post
Jude
post Jun 24 2009, 12:29 PM
Post #3


Whats this Lie-nix Thing?
*

Group: Members
Posts: 5
Joined: 23-June 09
Member No.: 14,517



QUOTE (michaelk @ Jun 24 2009, 09:33 AM) *
for i in $(ls *.whatever); do sed 's/oldstring/newstring/g' $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done

Basically this command will iterate the current directory for every file that matches *.whatever, replaces oldstring with newstring and creates a new file called filename-tmp
The original file filename is saved as filename-backup and the revised filename-tmp is renamed filename. Best to check this on some test files in a seperate directory.

Without knowing the distribution/version I assume your using bash. You can do this multiple times if there are more then one line that requires modification
Using a text editor.

#!/bin/bash
forfor i in $(ls *.whatever); do sed 's/oldstring/newstring/g' $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done
for i in $(ls *.whatever); do sed 's/oldstring1/newstring1/g' $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done



Thank, but I still dont think that this is the fix for my problem. It seems like this is still only changing filenames to lowercase AND NOT THE HTML CODE. The file naems have been changed already, ITS TEH HTML CODE THAT I WANT CHANGED. Can any help?
Go to the top of the page
 
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 22nd October 2017 - 07:51 PM