[ale] script or app to set all files to lower case
Michael B. Trausch
mike at trausch.us
Mon Aug 27 22:07:49 EDT 2007
James Taylor, on 08/27/2007 10:01 PM said:
> Also tested against a subset.
> Got the following error on each file.
>
> mv: target `' is not a directory: No such file or directory
>
> left orginal files unchanged.
>
> -jt
Crap.
Because I made a typo. :-P
find . | while read OldName; do
NewName=`echo $OldName|tr [A-Z] [a-z]`
mv -v "$OldName" "$NewName"
done
I put $i in there instead of $OldName because that's what I usually use
for my code. Not terribly intuitive, though...
This snippet is fixed. (See below sig) One note: Run it once for each
level of directory recursion you have. (Because the output of find is
static).
-- Mike
--
Michael B. Trausch Internet Mail & Jabber: mike at trausch.us
Phone: (404) 592-5746 x1 http://www.trausch.us/
Mobile: (678) 522-7934 VoIP: 6453 at sip.trausch.us, 861384 at fwd
Pidgin 2.1.1 and plugins for Ubuntu Feisty! http://www.trausch.us/pidgin
mbt at sage:~/Templates-2$ tree
.
|-- GnuCash File.gnc
|-- LaTeX
| |-- Book Chapter.tex
| `-- Book Master.tex
|-- OpenOffice.org
| |-- APA Formatted Paper.odt
| |-- Balance Sheet.ods
| |-- Manual Accounting Workbook.ods
| |-- OOo Presentation.odp
| |-- OOo Spreadsheet.ods
| |-- OOo Writer Document.odt
| `-- Spreadsheet Grapher.ods
|-- Programming
| |-- C file.c
| `-- C# File.cs
`-- Web
|-- Cascading Style Sheet.css
|-- HTML 4.0 Document.html
|-- PHP Script.php
`-- XHTML 1.1 Document.xhtml
4 directories, 16 files
mbt at sage:~/Templates-2$ find . | while read OldName; do
> NewName=`echo $OldName|tr [A-Z] [a-z]`
> mv -v "$OldName" "$NewName"
> done
mv: `.' and `./.' are the same file
`./Web' -> `./web'
mv: cannot stat `./Web/PHP Script.php': No such file or directory
mv: cannot stat `./Web/HTML 4.0 Document.html': No such file or directory
mv: cannot stat `./Web/Cascading Style Sheet.css': No such file or directory
mv: cannot stat `./Web/XHTML 1.1 Document.xhtml': No such file or directory
`./Programming' -> `./programming'
mv: cannot stat `./Programming/C# File.cs': No such file or directory
mv: cannot stat `./Programming/C file.c': No such file or directory
`./LaTeX' -> `./latex'
mv: cannot stat `./LaTeX/Book Chapter.tex': No such file or directory
mv: cannot stat `./LaTeX/Book Master.tex': No such file or directory
`./OpenOffice.org' -> `./openoffice.org'
mv: cannot stat `./OpenOffice.org/Balance Sheet.ods': No such file or
directory
mv: cannot stat `./OpenOffice.org/APA Formatted Paper.odt': No such file
or directory
mv: cannot stat `./OpenOffice.org/Manual Accounting Workbook.ods': No
such file or directory
mv: cannot stat `./OpenOffice.org/OOo Spreadsheet.ods': No such file or
directory
mv: cannot stat `./OpenOffice.org/OOo Writer Document.odt': No such file
or directory
mv: cannot stat `./OpenOffice.org/OOo Presentation.odp': No such file or
directory
mv: cannot stat `./OpenOffice.org/Spreadsheet Grapher.ods': No such file
or directory
`./GnuCash File.gnc' -> `./gnucash file.gnc'
mbt at sage:~/Templates-2$ find . | while read OldName; do NewName=`echo
$OldName|tr [A-Z] [a-z]`; mv -v "$OldName" "$NewName"; done
mv: `.' and `./.' are the same file
mv: cannot move `./web' to a subdirectory of itself, `./web/web'
`./web/PHP Script.php' -> `./web/php script.php'
`./web/HTML 4.0 Document.html' -> `./web/html 4.0 document.html'
`./web/Cascading Style Sheet.css' -> `./web/cascading style sheet.css'
`./web/XHTML 1.1 Document.xhtml' -> `./web/xhtml 1.1 document.xhtml'
mv: `./gnucash file.gnc' and `./gnucash file.gnc' are the same file
mv: cannot move `./latex' to a subdirectory of itself, `./latex/latex'
`./latex/Book Chapter.tex' -> `./latex/book chapter.tex'
`./latex/Book Master.tex' -> `./latex/book master.tex'
mv: cannot move `./programming' to a subdirectory of itself,
`./programming/programming'
`./programming/C# File.cs' -> `./programming/c# file.cs'
`./programming/C file.c' -> `./programming/c file.c'
mv: cannot move `./openoffice.org' to a subdirectory of itself,
`./openoffice.org/openoffice.org'
`./openoffice.org/Balance Sheet.ods' -> `./openoffice.org/balance sheet.ods'
`./openoffice.org/APA Formatted Paper.odt' -> `./openoffice.org/apa
formatted paper.odt'
`./openoffice.org/Manual Accounting Workbook.ods' ->
`./openoffice.org/manual accounting workbook.ods'
`./openoffice.org/OOo Spreadsheet.ods' -> `./openoffice.org/ooo
spreadsheet.ods'
`./openoffice.org/OOo Writer Document.odt' -> `./openoffice.org/ooo
writer document.odt'
`./openoffice.org/OOo Presentation.odp' -> `./openoffice.org/ooo
presentation.odp'
`./openoffice.org/Spreadsheet Grapher.ods' ->
`./openoffice.org/spreadsheet grapher.ods'
mbt at sage:~/Templates-2$ find . | while read OldName; do NewName=`echo
$OldName|tr [A-Z] [a-z]`; mv -v "$OldName" "$NewName"; done
mv: `.' and `./.' are the same file
mv: cannot move `./web' to a subdirectory of itself, `./web/web'
mv: `./web/html 4.0 document.html' and `./web/html 4.0 document.html'
are the same file
mv: `./web/xhtml 1.1 document.xhtml' and `./web/xhtml 1.1
document.xhtml' are the same file
mv: `./web/php script.php' and `./web/php script.php' are the same file
mv: `./web/cascading style sheet.css' and `./web/cascading style
sheet.css' are the same file
mv: `./gnucash file.gnc' and `./gnucash file.gnc' are the same file
mv: cannot move `./latex' to a subdirectory of itself, `./latex/latex'
mv: `./latex/book chapter.tex' and `./latex/book chapter.tex' are the
same file
mv: `./latex/book master.tex' and `./latex/book master.tex' are the same
file
mv: cannot move `./programming' to a subdirectory of itself,
`./programming/programming'
mv: `./programming/c file.c' and `./programming/c file.c' are the same file
mv: `./programming/c# file.cs' and `./programming/c# file.cs' are the
same file
mv: cannot move `./openoffice.org' to a subdirectory of itself,
`./openoffice.org/openoffice.org'
mv: `./openoffice.org/apa formatted paper.odt' and `./openoffice.org/apa
formatted paper.odt' are the same file
mv: `./openoffice.org/manual accounting workbook.ods' and
`./openoffice.org/manual accounting workbook.ods' are the same file
mv: `./openoffice.org/ooo writer document.odt' and `./openoffice.org/ooo
writer document.odt' are the same file
mv: `./openoffice.org/balance sheet.ods' and `./openoffice.org/balance
sheet.ods' are the same file
mv: `./openoffice.org/ooo presentation.odp' and `./openoffice.org/ooo
presentation.odp' are the same file
mv: `./openoffice.org/ooo spreadsheet.ods' and `./openoffice.org/ooo
spreadsheet.ods' are the same file
mv: `./openoffice.org/spreadsheet grapher.ods' and
`./openoffice.org/spreadsheet grapher.ods' are the same file
mbt at sage:~/Templates-2$ tree
.
|-- gnucash file.gnc
|-- latex
| |-- book chapter.tex
| `-- book master.tex
|-- openoffice.org
| |-- apa formatted paper.odt
| |-- balance sheet.ods
| |-- manual accounting workbook.ods
| |-- ooo presentation.odp
| |-- ooo spreadsheet.ods
| |-- ooo writer document.odt
| `-- spreadsheet grapher.ods
|-- programming
| |-- c file.c
| `-- c# file.cs
`-- web
|-- cascading style sheet.css
|-- html 4.0 document.html
|-- php script.php
`-- xhtml 1.1 document.xhtml
4 directories, 16 files
mbt at sage:~/Templates-2$
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
More information about the Ale
mailing list