filename character case in Arc/Info and unix

filename character case in Arc/Info and unix

Post by Donald Kackm » Mon, 20 Jan 1997 04:00:00



Okay here's an interesting problem:

I've written a small utility in MS Visual Basic 3.0 that creates text
files that I input into Arc/Info's Generate program. When processed by
Generate these text files create section-line coverages for townships and
counties in Minnesota.

Anyway the problem is that after running the program I have a large
number of Generate input files. Each of these files is written to my
DOS/Windows system with their filenames in UPPERCASE. Arc/Info's Generate
program doesn't seem to like UPPERCASE filenames (when I try to run
Generate and input an UPPERCASE filename it can't find it, but when I
rename the input file into lowercase it works fine).

Not being more than an amateur programmer, I can't get Visual Basic to
create lowercase filenames; and not being very Unix savvy I don't know if
there's an easy way to convert them on that side.

So the question is, does anyone know how to:

1) get MS Visual Basic 3.0 to create lowercase filenames.

2) convert the case of a large number filenames at once in either
DOS/Windows or Unix.

or

3) get Arc/Info to accept UPPECASE filenames in its Generate program.

Any suggestions are greatly appreciated because if I can't solve this
problem my little work saving utility only replaces one tedious job with
another.

Don Kackman

 
 
 

filename character case in Arc/Info and unix

Post by danny albert » Mon, 20 Jan 1997 04:00:00



> Okay here's an interesting problem:

> I've written a small utility in MS Visual Basic 3.0 that creates text
> files that I input into Arc/Info's Generate program. When processed by
> Generate these text files create section-line coverages for townships and
> counties in Minnesota.

> Anyway the problem is that after running the program I have a large
> number of Generate input files. Each of these files is written to my
> DOS/Windows system with their filenames in UPPERCASE. Arc/Info's Generate
> program d(snip)

> 1) get MS Visual Basic 3.0 to create lowercase filenames.

> 2) convert the case of a large number filenames at once in either
> DOS/Windows or Unix.

create a filelist of these upper case filenames.
write a unix script that reads this file, one name at a time
into a variable.  Either pipe it through sed '?/ABCDE.../abcde/g'
(where ? is either y or g, I can't remember which), and
that will be the name you want - assign it to another variable
and issue the rename command.

Option 2 - same technique, although substitute the sed command
with awk '{print tolower($1)}' (where $1 is the original value).
(snip)

Danny Alberts
Synergetics, Inc.

 
 
 

filename character case in Arc/Info and unix

Post by Gary M. Greenbe » Tue, 21 Jan 1997 04:00:00



>  Anyway the problem is that after running the program I have a large
>  number of Generate input files. Each of these files is written to my
>  DOS/Windows system with their filenames in UPPERCASE. Arc/Info's Generate
>  program doesn't seem to like UPPERCASE filenames (when I try to run
>  Generate and input an UPPERCASE filename it can't find it, but when I
>  rename the input file into lowercase it works fine).

[posted and emailed]

UNIX ARC/INFO cannot 'find' files with Uppercase characters in the path.
It is a known issue.

Quote:>  and not being very Unix savvy I don't know if
>  there's an easy way to convert them on that side.

     Caveat     Caveat     Caveat     Caveat     Caveat     Caveat
  to any who may use these; truly robust code would check for the
  pre-existence of each file already so named in lower case as
  UNIX will permit a directory to contain files named:

  filea, fiLeA, FileA, Filea, FILEA, ...

  albeit any user who does that is brilliant XOR criminally insane.

Here's mine in Perl:
#!/usr/bin/perl -w
foreach $i (0 .. $#ARGV) {
        print $ARGV[$i];
        print "\n";
        $FILENAME=$ARGV[$i];
        ($filename=$FILENAME) =~ y/A-Z/a-z/;
        rename($FILENAME,$filename);

Quote:}

Here's mine in Bourne shell:
#!/bin/sh
# u2l.sh ->> Transform Uppercase filenames to lowercase
for i
do
        mv $i `echo $i | tr 'A-Z' 'a-z'`
done

Donald,
The commands to convert the files to lowercase are:
(a) create the file u2l.sh
(b) chmod 700 u2l.sh
(c) rehash
(d) cd <where files to change are>
(e) /path_to_u2l.sh/u2l.sh <files to alter>

If the directory containing these Generate files are the ONLY files in
some directory that start with uppercase characters, you could do:

/path_to_u2l.sh/u2l.sh {[A-Z]*}

and all the files which were uppercase would be converted to lower case.

Cheers,

gary           /* GIS Applications Developer */

         1996 - 97 UF GATORS - * - NATIONAL CHAMPIONS!
           -=- visit The C Programmers' Reference -=-
        http://users.southeast.net/~garyg/main_page.html

 
 
 

filename character case in Arc/Info and unix

Post by Donald Kackm » Wed, 22 Jan 1997 04:00:00


A lot of people replied to my original post with some good ideas, some of
which I tried and they worked great.

The solution I'm using though was right in front the whole time. The FTP
program I use (WS_FTP for Win95) to send these files from my DOS machine
over to the Unix machine has a "force lowercase" option.

I would like to avoid this step in order to make the program easier to
use for other people, but after I posted my original message on
comp.lang.basic.visual.misc it appears that there's no way to create
lowercase filenames with Visual Basic.

Thanks for all the good ideas!

Don Kackman

 
 
 

filename character case in Arc/Info and unix

Post by Amos Shap » Thu, 23 Jan 1997 04:00:00



>create a filelist of these upper case filenames.
>write a unix script that reads this file, one name at a time
>into a variable.  Either pipe it through sed '?/ABCDE.../abcde/g'
>(where ? is either y or g, I can't remember which), and
>that will be the name you want - assign it to another variable
>and issue the rename command.
>Option 2 - same technique, although substitute the sed command
>with awk '{print tolower($1)}' (where $1 is the original value).
>(snip)

Or better still, use "tr", which is much lighter.  Here's what I use for
this purpose; I call it "lower" and give it a list of files as arguments,
e.g. "lower *.JPG":

#!/bin/sh
for f
do
        g=`echo $f | tr A-Z a-z`
        mv $f $g
done

(On some systems you'll have to do "tr '[A-Z]' '[a-z]'").

Have fun,
--

Paper: nSOF Parallel Software, Ltd.
       Givat-Hashlosha 48800, Israel
Tel: +972 3 9388551   Fax: +972 3 9388552        GEO: 34 55 15 E / 32 05 52 N

 
 
 

1. Change Upper case filename to lower case filename

Hi:

We would like to know is there solutions for change filenames from
uppercase to lower case in UNIX ? ( eg shellscript or C-program  to
perform on multiple files which filename all in Upper-case ).

Thank you in advanced.

Best Regards.
C.W.Lin

2. Is the a Source of a DOS-Telnet

3. Arc-Info/Arc-View Inquiry

4. init problem from Linux newbie

5. Script to Convert Upper Case Filenames to Lower Case

6. Kernel options

7. CONVERTING lower-case to upper-case filenames?

8. Device is open

9. Unix filename character length?

10. valid UNIX filename characters

11. How to change Windows-compliant filenames to Unix filenames

12. ARC/INFO and Linux

13. Arc/Info V7 on Solaris 2.3