В текущем каталоге и его подкаталогах, все файлы в именах которых содержется пробел заменить их на знак "_".
Доброго времени суток, многоуважемые.
Вот для решения сабжа попробовал использовать find,
find ./ -type f -regex ".* .*" -exec mv {} `echo {}|tr ' ' '_'` \;
но не добился желаемого:
stalker@ux /tmp/testdir $ ls -1
1 test file.txt
2 test file.txt
3 test file.txt
stalker@ux /tmp/testdir $ find ./ -type f -regex ".* .*" -exec mv {} `echo {}|tr ' ' '_'` \;
mv: `./2 test file.txt' and `./2 test file.txt' are the same file
mv: `./3 test file.txt' and `./3 test file.txt' are the same file
mv: `./1 test file.txt' and `./1 test file.txt' are the same file
Подскажите пожалуйста где ошибся?
--
Victor Skurihin
Jabber: stalker@jabber.org.ru
Reply to: