Does any one have a template shell script for doing something with ls for a list of directory names and looping through each one and doing something?
I'm planning to do ls -1d */ to get the list of directory names.
|
Does any one have a template shell script for doing something with I'm planning to do
| ||||
|
feedback
|
|
Just use a
You can replace the Within the For example, to rename all the
| |||||||
feedback
|
|
For files with spaces in you will have to make sure to quote the variable like:
or, you can change the input field separator (IFS) environment variable:
Finally, depending on what you're doing, you may not even need the ls:
| |||
|
feedback
|
|
If you have GNU Parallel http:// www.gnu.org/software/parallel/ installed you can do this:
To rename all .txt to .xml:
Watch the intro video for GNU Parallel to learn more: http://www.youtube.com/watch?v=OpaiGYxkSuQ | |||
|
feedback
|
|
This is how I do it, but there are probably more efficient ways.
| |||||||
feedback
|