vb 去掉文件名 空格
Spaces in file names are a nightmare with the web; you deal with %20
and other nonsense when spaces are in file names. That's why when I receive images with spaces I cringe; I mean hell, dealing with spaces of file systems sucks too.
文件名中的空格是网络的噩梦。 当文件名中包含空格时,您将处理%20
和其他废话。 这就是为什么当我收到带有空格的图像时我会畏缩的原因。 我的意思是,处理文件系统空间也很糟糕。
Anyways, I use the following command to remove spaces in file names within a directory:
无论如何,我使用以下命令删除目录中文件名中的空格:
# Replace spaces in file names with "-"
for f in *\ *; do mv "$f" "${f// /-}"; done
In this case I replace spaces with a dash. You can omit the dash if you'd rather there be nothing in place of spaces; underscores is another common pattern.
在这种情况下,我用破折号代替空格。 如果您希望在空格处没有任何内容,可以省略破折号。 下划线是另一种常见模式。
This script is not recursive, so it wont dive into subdirectories -- I don't usually have that case.
该脚本不是递归的,因此不会深入到子目录中-我通常没有这种情况。
vb 去掉文件名 空格