Path: utzoo!attcan!uunet!lll-winken!csd4.milw.wisc.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ukma!uflorida!haven!uvaarpa!hudson!biochsn.acc.Virginia.EDU!wrp From: wrp@biochsn.acc.Virginia.EDU (William R. Pearson) Newsgroups: comp.unix.xenix Subject: Re: Filenames -- converting Message-ID: <1613@hudson.acc.virginia.edu> Date: 8 Jun 89 21:43:03 GMT References: <1011@cernvax.UUCP> <3339@cps3xx.UUCP> <655@eecea.eece.ksu.edu> <25879@beta.lanl.gov> Sender: news@hudson.acc.virginia.edu Reply-To: wrp@biochsn.acc.Virginia.EDU.acc.Virginia.EDU (William R. Pearson) Organization: University of Virginia, Charlottesville Lines: 52 In article <25879@beta.lanl.gov> srb@beta.UUCP ( Steve Berger ) writes: > > I have a directory with all the filenames in Uppercase letters. > I'd like to move them all to lowercase. > > Is there an easy way to do that? I figure there must be a way using > sed or something, but I haven't figured it out yet, and I don't want to > go thru and use mv to move each file name, that will take me forever. > > Any ideas will be appreciated. > > Steve Berger > > srb@lanl.gov Here is a program called tolower, that takes an argument and returns it in lowercase. Compile it and use the csh script: foreach file (*) mv $file `tolower $file` end ======== tolower.c ========== /* tolower.c converts argument to lowercase on stdout */ #include main(argc,argv) int argc; char **argv; { if (argc > 1) {lowers(argv[1]); printf("%s",argv[1]); exit(0);} else exit(1); } lowers(str) char *str; { char tolower(); for (; *str; str++) *str = tolower(*str); } char tolower(chr) char chr; { if (chr>='A'&& chr<='Z') return chr-'A'+'a'; else return chr; }