如何更改子目录中的文件名

时间:2017-03-26 05:58:59

标签: linux bash shell unix mv

有一个子目录,其名称存储在名为str = str.replace(/\s*\d+\..*$/, ''); 的变量中。 我想将该目录中的所有文件重命名为小写版本。

所以我写了这段代码:

temp

但它不起作用。我怎样才能改变它?

1 个答案:

答案 0 :(得分:2)

你需要一个循环。

您可以使用Bash brace expansion转换为小写,而不是每次都创建额外流程的<TouchableOpacity onPress={this._onPress}> <View> ... Some view I want static ... </View> <ScrollView horizontal={true}> ... A bunch of components I want scrollable ... </ScrollView> </TouchableOpacity>

tr

如果你想要反转文件名的每个字符的大小写(感谢@SLePort提示):

#!/bin/bash
cd "$temp"
for f in *; do
  mv "$f" "${f,,}"
done
相关问题