vb 去掉文件名 空格_从文件名中删除空格

本文介绍了如何使用VB命令去除目录中文件名的空格,以解决网络上处理带空格文件名的问题。通过替换空格为破折号或下划线,避免了因空格导致的不便。此脚本不适用于处理子目录中的文件。
摘要由CSDN通过智能技术生成

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.

该脚本不是递归的,因此不会深入到子目录中-我通常没有这种情况。

翻译自: https://davidwalsh.name/remove-spaces-file-names

vb 去掉文件名 空格

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值