Script to convert windows files to linux

Script to convert windows files to linux

Post by Gert Kleeman » Tue, 01 Jul 2003 03:12:52



Hey,

Can anyone point me to a script somewhere that can recursively go
through subdirectories and change the filesnames to linux compatible
format(lowercase, nospaces, etc) and also update links in html files?

Thanks,
Gert

 
 
 

Script to convert windows files to linux

Post by Grant Edward » Tue, 01 Jul 2003 03:18:24



> Can anyone point me to a script somewhere that can recursively go
> through subdirectories and change the filesnames to linux compatible
> format(lowercase, nospaces, etc) and also update links in html files?

Um, Linux allows spaces and uppercase in filenames, so I don't
see any reason they're not "linux compatible" now.

--
Grant Edwards                   grante             Yow!  I'm ZIPPY the PINHEAD
                                  at               and I'm totally committed
                               visi.com            to the festive mode.

 
 
 

Script to convert windows files to linux

Post by Gareth William » Tue, 01 Jul 2003 04:58:14




>> Can anyone point me to a script somewhere that can recursively go
>> through subdirectories and change the filesnames to linux compatible
>> format(lowercase, nospaces, etc) and also update links in html files?

> Um, Linux allows spaces and uppercase in filenames, so I don't see any
> reason they're not "linux compatible" now.

I don't see the issue with upper/lowercase but gaps in filenames can be a
pain on *nix systems.  This pipeline works for me.  Stick it in a script
and kiss those "no such file or directory" woes:

ls *" "*|while read F;do N=`echo "$F"|tr ' ' '_'`; mv "$F" "$N"; done

By the way, this looks for all files with gaps in the current directory
and renames them, so be aware that you shouldn't run it arbitrarily, and
certainly never as root.

--

Regards,
Gareth Williams

 
 
 

Script to convert windows files to linux

Post by Grant Edward » Tue, 01 Jul 2003 06:49:14



>>> Can anyone point me to a script somewhere that can recursively
>>> go through subdirectories and change the filesnames to linux
>>> compatible format(lowercase, nospaces, etc) and also update
>>> links in html files?

>> Um, Linux allows spaces and uppercase in filenames, so I don't
>> see any reason they're not "linux compatible" now.

> I don't see the issue with upper/lowercase but gaps in
> filenames can be a pain on *nix systems.

Yes, I have run into buggy shellscripts that don't deal well
with spaces in filenames.  An application that does not
tolerate spaces in filenames is quite plainly broken and ought
to be fixed.  But, it's proabably easier to rename files...

--
Grant Edwards                   grante             Yow!  ... If I had heart
                                  at               failure right now,
                               visi.com            I couldn't be a more
                                                   fortunate man!!

 
 
 

Script to convert windows files to linux

Post by Gert Kleeman » Tue, 01 Jul 2003 07:22:27





>>>Can anyone point me to a script somewhere that can recursively go
>>>through subdirectories and change the filesnames to linux compatible
>>>format(lowercase, nospaces, etc) and also update links in html files?

>>Um, Linux allows spaces and uppercase in filenames, so I don't see any
>>reason they're not "linux compatible" now.

> I don't see the issue with upper/lowercase but gaps in filenames can be a
> pain on *nix systems.  This pipeline works for me.  Stick it in a script
> and kiss those "no such file or directory" woes:

> ls *" "*|while read F;do N=`echo "$F"|tr ' ' '_'`; mv "$F" "$N"; done

> By the way, this looks for all files with gaps in the current directory
> and renames them, so be aware that you shouldn't run it arbitrarily, and
> certainly never as root.

Issue with upper/lowercase is that it is simply annoying to capitalize
some letters of a filename.

It's a nice pipeline - but with about 2000 directories it gets old
really fast :) ... hmm how do you make a bash script go through
subdirectoryes?

 
 
 

Script to convert windows files to linux

Post by lcoe » Tue, 01 Jul 2003 07:41:18




>>>> Can anyone point me to a script somewhere that can recursively
>>>> go through subdirectories and change the filesnames to linux
>>>> compatible format(lowercase, nospaces, etc) and also update
>>>> links in html files?

>>> Um, Linux allows spaces and uppercase in filenames, so I don't
>>> see any reason they're not "linux compatible" now.

>> I don't see the issue with upper/lowercase but gaps in
>> filenames can be a pain on *nix systems.
> Yes, I have run into buggy shellscripts that don't deal well
> with spaces in filenames.  An application that does not
> tolerate spaces in filenames is quite plainly broken and ought

huh?  i know special chars can be escaped but how can you expect
an application to divine where spaces are in a filename?   --Loren
Quote:> to be fixed.  But, it's proabably easier to rename files...
> --
> Grant Edwards                   grante             Yow!  ... If I had heart
>                                   at               failure right now,
>                                visi.com            I couldn't be a more
>                                                    fortunate man!!

 
 
 

Script to convert windows files to linux

Post by Dances With Crow » Tue, 01 Jul 2003 08:20:18


On Mon, 30 Jun 2003 01:22:27 +0300, Gert Kleemann staggered into the
Black Sun and said:


>> I don't see the issue with upper/lowercase but gaps in filenames can
>> be a pain on *nix systems.  This pipeline works for me.  Stick it in
>> a script and kiss those "no such file or directory" woes:

>> ls *" "*|while read F;do N=`echo "$F"|tr ' ' '_'`; mv "$F" "$N"; done

>> By the way, this looks for all files with gaps in the current
>> directory and renames them, so be aware that you shouldn't run it
>> arbitrarily, and certainly never as root.

> It's a nice pipeline - but with about 2000 directories it gets old
> really fast :) ... hmm how do you make a bash script go through
> subdirectoryes?

Turn it into a function called "killspaces", then make another function
called "killspaces_recurse" that uses recursion?  I banged something
together that did this, http://groups.google.com/advanced_group_search ,

Warning:  That script has not been extensively tested, and may blow up
in your face when you least expect it.

--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin /
http://www.brainbench.com     /  "He is a rhythmic movement of the
-----------------------------/    penguins, is Tux." --MegaHAL

 
 
 

Script to convert windows files to linux

Post by Grant Edward » Tue, 01 Jul 2003 09:33:11



>>>>> Can anyone point me to a script somewhere that can recursively go through
>>>>> subdirectories and change the filesnames to linux compatible
>>>>> format(lowercase, nospaces, etc) and also update links in html files?

>>>> Um, Linux allows spaces and uppercase in filenames, so I don't see any
>>>> reason they're not "linux compatible" now.

>>> I don't see the issue with upper/lowercase but gaps in filenames can be a
>>> pain on *nix systems.

>> Yes, I have run into buggy shellscripts that don't deal well with spaces in
>> filenames.  An application that does not tolerate spaces in filenames is
>> quite plainly broken and ought

> huh?  i know special chars can be escaped but how can you expect an
> application to divine where spaces are in a filename?

Huh?  It doesn't have to "divine" anything.  If an application is expecting
an argument that's a filename, and I pass it an argument, then it should use
that argument's value as a filename (regardless of what characters the
arguement contains).  Applications that require filenames not to contain
certain characters are just plain broken.  [With the obvious excpetion of
'/', which the system call API defines as not allowed in filenames.]

--
Grant Edwards                   grante             Yow!  Maybe we could paint
                                  at               GOLDIE HAWN a rich PRUSSIAN
                               visi.com            BLUE --

 
 
 

Script to convert windows files to linux

Post by Ed Murph » Tue, 01 Jul 2003 09:49:59



>> huh?  i know special chars can be escaped but how can you expect an
>> application to divine where spaces are in a filename?
> Huh?  It doesn't have to "divine" anything.  If an application is expecting
> an argument that's a filename, and I pass it an argument, then it should use
> that argument's value as a filename (regardless of what characters the
> arguement contains).  Applications that require filenames not to contain
> certain characters are just plain broken.  [With the obvious excpetion of
> '/', which the system call API defines as not allowed in filenames.]

Question is, if the arguments are passed on the command line, then how
are (spaces that are part of a filename) distinguished from (spaces that
are used to separate arguments)?  This is mostly an issue with the shell,
and only indirectly an issue with applications (e.g. if they build a new
shell command containing an argument).

In my copy of bash, (spaces that are part of a filename) are distinguished
by prepending them with '\'.

 
 
 

Script to convert windows files to linux

Post by Grant Edward » Tue, 01 Jul 2003 11:07:05



> Question is, if the arguments are passed on the command line, then how
> are (spaces that are part of a filename) distinguished from (spaces that
> are used to separate arguments)?

Each argument is passed as a char* to a null terminated string.  The
application doesn't have to figure out how to "distinguish" one argument
from another.  It's already been done.  If you don't know how shell quoting
works, then a good book on bash is probably in order.  The O'Reilly one is
supposed to be good.  Here's a quick example.

$ command "first filename with spaces"  second\ another\ filename\ with\ spaces

The program "command" is only passed three arguments (counting argv[0]). It
should'nt care whether the two filename arguments have spaces or not.  If
you're using bash, the tab-completion mechanism even works properly with
filenames containing spaces.  If you find a program that doesn't work if
it's passed a filename containing spaces, you should report the bug to the
maintainer of the program.

Quote:> In my copy of bash, (spaces that are part of a filename) are distinguished
> by prepending them with '\'.

That's one way.  You can also enclose the filename in quotes.

--
Grant Edwards                   grante             Yow!  Are you selling NYLON
                                  at               OIL WELLS?? If so, we can
                               visi.com            use TWO DOZEN!!

 
 
 

Script to convert windows files to linux

Post by Roodwri.. » Tue, 01 Jul 2003 11:12:47



> Hey,

> Can anyone point me to a script somewhere that can recursively go
> through subdirectories and change the filesnames to linux compatible
> format(lowercase, nospaces, etc) and also update links in html files?

> Thanks,
> Gert

Linux handles files with uppercase letters with no problem. However, unlike
Windows, it considers a file with an uppercase name different than one
that's lower case. It's case-sensitive, but not case-rejective.

shakespeare.txt and Shakespeare.txt would be two different files. And both
would be legal names.

The only difference you may run across is in file managers or save or open
dialog boxes. Linux MAY put things in ASCII alphabetical order. That is,
Shakespeare and shakespeare will be in different parts of the list,
lowercase in one part, uppercase in another. However, other file managers,
such as Konquerer, can be set to be case-insensitive and it'll line them
all up like you think. Other KDE programs will do this also.

Most Linux programs also don't care about spaces. They'll handle them.
Mostly you'll run into the space issue if you call up a file from the
command line. But if that's the case, put the file name in quotes like "My
Cool Novel.txt." That way the command line will know it has to consider it
all as one thing.

--Rod

--
Author of "Linux for Non-Geeks--Clear-eyed Answers for Practical Consumers"
and "Boring Stories from Uncle Rod." Both are available at
http://www.rodwriterpublishing.com/index.html

To reply by e-mail, take the extra "o" out of my e-mail address. It's to
confuse spambots, of course.

 
 
 

Script to convert windows files to linux

Post by Gert Kleeman » Tue, 01 Jul 2003 16:34:44




>>Hey,

>>Can anyone point me to a script somewhere that can recursively go
>>through subdirectories and change the filesnames to linux compatible
>>format(lowercase, nospaces, etc) and also update links in html files?

>>Thanks,
>>Gert

> Linux handles files with uppercase letters with no problem. However, unlike
> Windows, it considers a file with an uppercase name different than one
> that's lower case. It's case-sensitive, but not case-rejective.

> shakespeare.txt and Shakespeare.txt would be two different files. And both
> would be legal names.

> The only difference you may run across is in file managers or save or open
> dialog boxes. Linux MAY put things in ASCII alphabetical order. That is,
> Shakespeare and shakespeare will be in different parts of the list,
> lowercase in one part, uppercase in another. However, other file managers,
> such as Konquerer, can be set to be case-insensitive and it'll line them
> all up like you think. Other KDE programs will do this also.

> Most Linux programs also don't care about spaces. They'll handle them.
> Mostly you'll run into the space issue if you call up a file from the
> command line. But if that's the case, put the file name in quotes like "My
> Cool Novel.txt." That way the command line will know it has to consider it
> all as one thing.

> --Rod

I know linux can handle filenames with spaces and uppercase characters,
but there is something to be said for homogeneous filenames - aesthetic
pleasure, if nothing more :).
 
 
 

Script to convert windows files to linux

Post by Roodwri.. » Wed, 02 Jul 2003 00:44:34





>>>Hey,

>>>Can anyone point me to a script somewhere that can recursively go
>>>through subdirectories and change the filesnames to linux compatible
>>>format(lowercase, nospaces, etc) and also update links in html files?

>>>Thanks,
>>>Gert

>> Linux handles files with uppercase letters with no problem. However,
>> unlike Windows, it considers a file with an uppercase name different than
>> one that's lower case. It's case-sensitive, but not case-rejective.

>> shakespeare.txt and Shakespeare.txt would be two different files. And
>> both would be legal names.

>> The only difference you may run across is in file managers or save or
>> open dialog boxes. Linux MAY put things in ASCII alphabetical order. That
>> is, Shakespeare and shakespeare will be in different parts of the list,
>> lowercase in one part, uppercase in another. However, other file
>> managers, such as Konquerer, can be set to be case-insensitive and it'll
>> line them all up like you think. Other KDE programs will do this also.

>> Most Linux programs also don't care about spaces. They'll handle them.
>> Mostly you'll run into the space issue if you call up a file from the
>> command line. But if that's the case, put the file name in quotes like
>> "My Cool Novel.txt." That way the command line will know it has to
>> consider it all as one thing.

>> --Rod

> I know linux can handle filenames with spaces and uppercase characters,
> but there is something to be said for homogeneous filenames - aesthetic
> pleasure, if nothing more :).

Sorry. I had gotten the impression that you thought there was a rule they
HAD to be lowercase and without spaces. If it's your choice to convert all
of them, that's fine. I mistakenly thought you believed it was a necessity.

Again, sorry.

--Rod

--
Author of "Linux for Non-Geeks--Clear-eyed Answers for Practical Consumers"
and "Boring Stories from Uncle Rod." Both are available at
http://www.rodwriterpublishing.com/index.html

To reply by e-mail, take the extra "o" out of my e-mail address. It's to
confuse spambots, of course.

 
 
 

Script to convert windows files to linux

Post by Lee Sau Da » Thu, 03 Jul 2003 16:40:56


    >> ls *" "*|while read F;do N=`echo "$F"|
    >>      tr ' ' '_'`; mv "$F" "$N";

    Gert> Issue with upper/lowercase is that it is simply annoying to
    Gert> capitalize some letters of a filename.

    Gert> It's a nice pipeline - but with about 2000 directories it
    Gert> gets old really fast :) ... hmm how do you make a bash
    Gert> script go through subdirectoryes?

Use 'find' instead of 'ls'.  BTW,  are you aware that this use of 'ls'
won't handle files whose names start with a "."?

I'd do it this way:

        find . -name '*[ !"*?]*' | (while read F;
                do N=`echo "$F" | tr ' !"*?A-Z' '_____a-z';
                   mv -i "$F" "$N"; done)

Of course,  you should first  use "echo" instead  of "mv -i" so  as to
check what will happen before you really do it.

--


Home page: http://www.informatik.uni-freiburg.de/~danlee

 
 
 

1. A Linux user converts back to Windows; was Re: Converting a few Windows users...

Come on Peter you have to admit that the original post reads like a
'religious zealot' telling us all of his latest attempts to convert
unbelievers to cause......

As an alternative have a read of this.....

A Linux user goes back.
By Tony kNIGits Collins.

Introduction...
In much of today's online news, we hear of how many people are migrating
to GNU/Linux. What we don't seem to hear much of, is users going back to
their old operating systems. The reason for this article is to say that
I've done just that.

Yes, I've gone back. After three and a half years of trying to make
GNU/Linux work on the desktop, I've decided that it's simply too hard
for the average home user. Before I go into my reasons for going back,
let me outline what I believe an 'average' home user is. Mr Joe Average
is someone who wants to install their OS, boot it up, and it works. He
wants to be able to upgrade his PC , and have the hardware work in a few
short minutes. He wants to read email, browse the web, talk to his mates
online, and play some games. Feel free to disagree with me, this is
merely how I see myself. Note: I'm not referring to Grandma using Linux,
or even my mum using it. I'm referring to average users who know a
little about their computer.

Three and a half years; that's how long I've been trying to make Linux
work on my desktop computer. Right about now, I'm sure that you are now
screaming that I didn't try hard enough, or that I'm just plain stupid.
Let me assure you that this is not the case. Stupid users don't doggedly
stick at something for three and a half years, trying distribution after
distribution in the hope of finding the holy grail of Linux desktops.
They give up in less than a few hours of trying to (unsuccessfully)
install RedHat Linux. Hear now my sad tale of why Linux isn't suitable
for my desktop.

http://members.optusnet.com.au/~knigits/articles/switched_back.html

-----------------------------
# Been there, done that. Linux will not take me where I want to go. I
hung all the Linux CDs in my grape vines to keep the birds away.
Mike, alt.os.windows-xp
--


Replace the obvious with paradise to email me.

See Found Images at :
http://homepages.paradise.net.nz/~mlvburke

2. POP3 from internet Linux box to SCO 5.0

3. convert sh script to bat file for windows

4. Logging Users

5. Converting files between Linux and DOS/Windows

6. TRICKof 3c509x cards!

7. converting file dates into script variables

8. Where to find libm.so.4 ?

9. Convert small shell script to batch file

10. Convert script to binary file

11. Unix Script to convert text files to DOS format?

12. how can i convert shell script(text file) into a binary!

13. Converting unix shell scripts to dos batch files