Change htmlpages to lower case - online

Boodles

Executive Member
Joined
Dec 28, 2005
Messages
5,294
Reaction score
3
Hi,

Wondering if there is an easier way to do this than for me to upload everything again. S L O W - C O N N E C T I O N ...

I have 900 or so html pages, that are in captials and i need to put them in lower case.

IS there a proggie that can do this on my ftp server thingy?
 
Hi Boodles

If you are making use of CSS, there might be a solution.

You can make use of the text transformation properties, which will be able to automatically turn all text in lower or upper case and also capitalize every first letter of a sentence.

By bringing in the following into your CSS file will do just what you want:

p.lowercase {text-transform: lowercase}
p.capitalize {text-transform: capitalize}

If you do not make use of CSS, add the following to your <HEAD></HEAD> section of your HTML pages:

Code:
<style type="text/css">
p.lowercase {text-transform: lowercase}
p.capitalize {text-transform: capitalize}
</style>

I had a similar article on my forum regarding this, here
 
Last edited:
I think boodles needs the actual filenames changed? This is easily done if you have shell access, boodles:

foreach f ( * )
mv $f 'echo $f | tr '[A-Z]' '[a-z]''

or something along those lines would do it.
 
I think I did not read properly then, but I agree with you on the shell access.
 
If it is the file names that is the problem and you are on a Unix server, you might be interested in this:

ftp://kermit.columbia.edu/kermit/utils/xxu.c

Code:
/*  X X U  --  UNIX filename converter  */

/*
  Lowercases filenames and strips spurious pathnames from them.  Handy for
  use after UNZIPs or FTP MGETs or magnetic tape operations that leave your
  UNIX directory full of uppercase filenames, possibly with foreign paths
  included.  Path stripping handles UNIX, DOS, VMS, and TOPS-20/TENEX
  formats.

  Usage: xxu file(s)

  Action: Renames argument files as follows:
   strips DOS or DEC device:, node:: names from front (up to rightmost ':')
   strips DOS path name from front (up to rightmost '\') if present
   strips VMS [directory] or DEC-20 <directory> name if present
   strips UNIX path name from front (up to rightmost '/') if present
   strips VMS version number from end (everything after ';') if present
   strips DEC-20 attributes from end (everything after ';') if present
   if name is all uppercase it is converted to lowercase
   converts spaces to underscores
   honors Ctrl-V quote for special characters
   discards unquoted unprintable characters
   if result is null, file is renamed to xxfile-n, where n is a number.
   if result would write over an existing file, file also renamed to xxfile-n.

  Typical usage: make a new directory, cd to it, then FTP files from
  DOS, Windows, VMS, etc, or Unzip them from an archive, then "xxu *"
  to fix the names.  Files that already have lowercase names (and no path
  part included) are not touched.

  Author:  F. da Cruz, The Kermit Project, Columbia University
  Email:   [email protected]

  Please send any changes back to the author.

  Revised: Jul 1985: First version
           Sep 1998: Provide for no rename(), handle spaces.
           Jul 1999: Add support for DOS pathname stripping.
           Oct 2000: Don't lowercase mixed-case names.

  Copyright (C) 1999,2000
  Trustees of Columbia University in the City of New York

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
#include <stdio.h>
#ifdef SYSV
#include <sys/types.h>
#else
#ifdef M_XENIX
#include <sys/types.h>
#endif /* M_XENIX */
#endif /* SYSV */
#include <ctype.h>
#include <sys/file.h>			/* For access() */

/* Define NO_RENAME on cc command line if rename() missing */

#ifdef NO_RENAME
/* Use rename() if available since rename() is atomic and this isn't. */
int
rename(oldname, newname) char *oldname, *newname; {
    if (link(oldname,newname) < 0) {
	perror("link");
	return(-1);
    } else if (unlink(oldname) < 0) {
	perror("unlink");
	return(-1);
    } else
      return(0);
}
#endif /* NO_RENAME */

char name[1024];			/* File name buffer */
char *pp, *cp, *xp;			/* Character pointers */
char delim;				/* Directory Delimiter */
int dc = 0, n = 0;			/* Counters */
int quote = 0, indir = 0, done = 0;	/* Flags */

main(argc,argv) int argc; char **argv; {
    int lc;

    if (argc < 2) {			/* Give message if no args */
	fprintf(stderr,"Usage: xxu file(s)\n");
	exit(1);
    }
    n = 0;				/* Unfixable filename counter */
    while (--argc > 0) {		/* For all files on command line... */
	argv++;
	xp = *argv;			/* Copy pointer for simplicity */
	lc = 0;				/* For case conversion */
	for (cp = xp; *cp; cp++) {	/* Quick prescan for mixed case */
	    if (islower(*cp)) lc++;
	}
	printf("%s ",*argv);		/* Echo name of this file */

	pp = name;			/* Point to translation buffer */
	*name = '\0';			/* Initialize buffer */
	dc = 0;				/* Filename dot counter */
	done = 0;			/* Flag for early completion */

	for (cp = xp; (*cp != '\0') && !done; cp++) { /* Loop thru chars... */

	    if (quote) {		/* If this char quoted, */
		*pp++ = *cp;		/*  include it literally. */
		quote = 0;
	    } else if (indir) {		/* If in directory name, */
		if (*cp == delim)
		  indir = 0;		/* look for end delimiter. */
	    } else switch (*cp) {
	      case '<':			/* Discard DEC-20 directory name */
		indir = 1;
		delim = '>';
		break;
	      case '[':			/* Discard VMS directory name */
		indir = 1;
		delim = ']';
		break;
	      case '/':			/* Discard Unix path name */
	      case '\\':		/*  or DOS path name */
	      case ':':   	    	/*  or DOS/DEC dev: or node:: name */
		pp = name;
		break;
#ifdef COMMENT
/* We don't have too many DEC-20s any more, but we do have *.tar.gz's */
	      case '.':			/* DEC -20 generation number */
		if (++dc == 1)		/* Keep first dot */
		  *pp++ = *cp;
		else			/* Discard everything starting */
		  done = 1;		/* with second dot. */
		break;
#endif /* COMMENT */
	      case ';':			/* VMS version or DEC-20 attribute */
		done = 1;		/* Discard everything starting with */
		break;			/* semicolon */
	      case '\026':		/* Control-V quote for special chars */
		quote = 1;		/* Set flag for next time. */
		break;
	      default:
		if (lc == 0 && isupper(*cp)) /* Uppercase letter to lower */
		  *pp++ = tolower(*cp);
		else if (*cp == ' ')	/* change blanks to underscore */
		  *pp++ = '_';
		else if (isprint(*cp))	/* Other printable, just keep */
		  *pp++ = *cp;
	    }
	}
	*pp = '\0';			/* Done with name, terminate it */
	if (strcmp(name,xp) == 0) {	/* If no renaming necessary, */
	    printf("(ok)\n");		/*  just give message. */
	    continue;
        }
	while (*name == '\0' || access(name,0) == 0) { /* Find unique name */
	    sprintf(name,"xxfile-%d",n++);
	}
	printf("=> %s ",name);		/* Tell what new name will be */
	if (rename(xp,name) == 0)	/* Try to rename it */
	  printf("(ok)\n");		/* Say what happened */
	else
#ifndef NO_RENAME
	  perror("failed");
#else
	  printf("(failed)\n");
#endif /* NO_RENAME */
    }
    exit(0);				/* Done. */
}
 
Last edited:
Well, so i've dived right in and am learning a bit about websites.

Got a crappy one up now, and will update/upgrade as i go along. I uploaded everything again after the host ask me to please convert everything to lower case - f its a pain as i have shyte connection, but thanks to all for suggestions above.

I'm upgrading the website completely in January, when i have moved into a decent area with proper connection, in the mean time, i'll fiddle with it a bit including trying out joomla.

As i already have html pages for my website on my pc - i want to play around and make it a bit better with Joomla. I've searched the joomla forum, and have downloaded joomla/and help file. It seems i need to also download XAMPP to get Joomla working, is that right? Is there an alternate?
 
OK, i see that i must use XAMPP according to Chris.

cash, are you installing it locally (on your computer) or on a server somewhere?

If you want to install on your computer you need to set it up as a server (ie, apache, mysql and php) - xampp is the easiest way to do that (just download, follow instructions and install).

General joomla installation instructions here.

EDIT - OK, i see you can also use Wampserver, i'm downloading that now and will give it a whirl.

Thanks.
 
Last edited:
Hi Boodles,

Your host should actually be willing to handle such a big job for you.

By the way, what is the URL? I'd love to check it out ^^
 
Its just a family tree website, and its butt-ugly, not worth looking at.

Anyway, i've got joomla working so will play around with it over the next few motnhs.

Thanks.
 
Good to hear you've sorted it out, Boodles.

Let us know when the new site's ready or if you need any other help ;)
 
For future reference my hosts allow me to upload a single tar archive and then run this from a php file to extract all the files.
PHP:
<? system( "tar xzvf Archive*.tgz" ) ?>
I've found that uploading a single file is far less time consuming than hundreds of other files.
 
For future reference my hosts allow me to upload a single tar archive and then run this from a php file to extract all the files.
PHP Code:
<? system( "tar xzvf Archive*.tgz" ) ?>
I've found that uploading a single file is far less time consuming than hundreds of other files.

Hi bwana,

That would really be a host in the minority, as allowing system execution should actually be a disabled PHP function for greater security. (for instance, someone upload a similar PHP file, but this time it's destructive).

There are ways around this, but not many hosts would allow it.
 
Hi bwana,

That would really be a host in the minority, as allowing system execution should actually be a disabled PHP function for greater security. (for instance, someone upload a similar PHP file, but this time it's destructive).

There are ways around this, but not many hosts would allow it.
Oh well - it works for me though :)

They also allow for similar functionality via the control panel - do you guys at least offer that?
 
Oh well - it works for me though

They also allow for similar functionality via the control panel - do you guys at least offer that?

Hi bwana,

We do offer (jailed) SSH access - what the code example showed was a shell command being executed from a PHP script. They can run that command straight from SSH. The means to extract as well as compress are available from the client's control panel, yes.

However we'll just do it for the client if they need, as we wouldn't expect them to know the command or where how to extract.
 
Last edited:
Top
Sign up to the MyBroadband newsletter
X