I have a number of directories which should all be named with 5 digits - unfortunately some contain spaces (users - who'd have 'em?). This is what some of them are called:
63542
65438
63542
63583 68267 <- this is one directory
63582
I need to perform an action on each directory's contents & intend to use a for loop:
for dir in `ls [0-9]*`
do
... whatever
but the ls command here doesn't identify the directory names with spces - what it does is produce separate names for each part of the name. ie it tries to perform the code in the loop on 63583 AND 68267 as well as the others. I've tried
for dir in `ls "[0-9]*"`
do
... whatever
and
for dir in `ls '[0-9]*'`
do
... whatever
but they both explicitly look for a directory called [0-9]*.
Does anyone have any suggestions?
TIA, Chris
63542
65438
63542
63583 68267 <- this is one directory
63582
I need to perform an action on each directory's contents & intend to use a for loop:
for dir in `ls [0-9]*`
do
... whatever
but the ls command here doesn't identify the directory names with spces - what it does is produce separate names for each part of the name. ie it tries to perform the code in the loop on 63583 AND 68267 as well as the others. I've tried
for dir in `ls "[0-9]*"`
do
... whatever
and
for dir in `ls '[0-9]*'`
do
... whatever
but they both explicitly look for a directory called [0-9]*.
Does anyone have any suggestions?
TIA, Chris