This is great! Thanks very much. I'll use it and learn from it.
Any opportunity to understand programming better is always a bonus.
I'm a guy who didn't discover what algebra is for until my mid-40s
when I got my first Amiga 500, learned ARexx, and some AmigaDOS.
ARexx is just my speed, OOP languages have confused me to pieces.
Python excited me because it allows functionality with merely an
ARexx kind of knowledge. Thank you, programming community! BTW
somehow my son graduated UC Santa Cruz with a BA in Math, and is
going on to become a math teacher...ain't life funny?
Greg
On 8-Oct-2010, at 10:15, Greg Reyna wrote:
Thanks. I'll practice my Python to accomplish this
Oh, you don't need python. you can do it from the shell (or a shell worksheet)
First, test:
$ for i in `ls`; do echo $i ${i}.txt; done
if there are no files with spaces in their names, this will look
fine, and you can then do:
$ for i in `ls`; do mv $i ${i}.txt; done
If there ARE names with spaces, you need to use find instead.
$ find . -type f -exec mv "{}" "{}.txt" \;
Why not just always use the find format? Well, you can, but I find
the for loop much more understandable, so I use that unless I am
forced to use find.
$ touch "fred smith" "george williams" "alice pratt" "mary claire"
"zeak the freak"
$ ls -ln
total 0
-rw-r--r--+ 1 601 20 0 Oct 9 09:57 alice pratt
-rw-r--r--+ 1 601 20 0 Oct 9 09:57 fred smith
-rw-r--r--+ 1 601 20 0 Oct 9 09:57 george williams
-rw-r--r--+ 1 601 20 0 Oct 9 09:57 mary claire
-rw-r--r--+ 1 601 20 0 Oct 9 09:57 zeak the freak
$ find . -type f -exec mv "{}" "{}.txt" \;
$ ls -ln
total 0
-rw-r--r--+ 1 601 20 0 Oct 9 09:57 alice pratt.txt
-rw-r--r--+ 1 601 20 0 Oct 9 09:57 fred smith.txt
-rw-r--r--+ 1 601 20 0 Oct 9 09:57 george williams.txt
-rw-r--r--+ 1 601 20 0 Oct 9 09:57 mary claire.txt
-rw-r--r--+ 1 601 20 0 Oct 9 09:57 zeak the freak.txt
--
It's better to burn out than it is to rust -- Neil Young as quoted be
Kurt Cobain
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>