public inbox for speakup@linux-speakup.org
 help / color / mirror / Atom feed
* windows files to linux?
@  TheCreator
   ` Ralph W. Reid
  0 siblings, 1 reply; 2+ messages in thread
From: TheCreator @  UTC (permalink / raw)
  To: Speakup is a screen review system for Linux.

Hello list,
I've got a ton of files that have half capital letters, etc etc.
I was wondering if there was a program that would go through and make my file names lowercase, (only on a selected folder), and put an _ between the spaces.
Thanks,
~~TheCreator~~

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: windows files to linux?
   windows files to linux? TheCreator
@  ` Ralph W. Reid
  0 siblings, 0 replies; 2+ messages in thread
From: Ralph W. Reid @  UTC (permalink / raw)
  To: Speakup is a screen review system for Linux.

My choice would be to replace the spaces with underline characters.
However, you indicated that you wanted space characters to be replaced
with ' _ ' strings--to each his own, I guess.  This little script
should do what you want (I hope).  Use at your own risk.

#!/bin/bash
#win2lin.sh
#converts Windblows file names to Linux file names
#Spaces in file names are translated to ' _ '
#upper case letters in file names are converted to lower case
#This script only performs conversions in the current directory--no
#directory tree traversal is provided.
#Use this script at your own risk.

function win2lin_func {
for i in *
do
  newname=`echo $i | tr [A-Z] [a-z] | sed "s/ / _ /g"`
  if [ "$newname" != "$i" ]; then
    echo Renaming \"$i\" to \"$newname\"
    mv -i "$i" "$newname"
  fi
done
}

#mainline code
#check for a single command line parameter

if [ "$#" != "1" ]; then
  echo Usage $0:
  echo $0 param/
  echo where param is the directory where files are to be renamed
  echo "(be sure to include the trailing /)."
  exit 1
fi

#process the file names
win2lin_func

#end of win2lin script

HTH, and have a _great_ day!

On Sat, May 26, 2007 at 10:30:34AM -0600, TheCreator wrote:
> Hello list,
> I've got a ton of files that have half capital letters, etc etc.
> I was wondering if there was a program that would go through and make my file names lowercase, (only on a selected folder), and put an _ between the spaces.
> Thanks,
> ~~TheCreator~~

-- 
Ralph.  N6BNO.  Wisdom comes from central processing, not from I/O.
rreid@sunset.net  http://personalweb.sunset.net/~rreid
...passing through The City of Internet at the speed of light...
_PI = 4 * ARCTAN (1)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~ UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
 windows files to linux? TheCreator
 ` Ralph W. Reid

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).