[linux][通用]针对裁剪型的busy box下的批量选择性文件修改方式

在开发中,有时候使用的系统有裁剪,导致许多的linux命令实际上不能够使用,设计中遇到需要针对文件进行批量选择性重命名,或者删除,使用网上的一些常用命令,包括xargs命令的方式,但是都提示说命令找不到,因此使用了如下方式来解决这个问题:

使用命令:

for i in filePath/*.fileType.temp; do mv -vf "$i" "${i%.fileType.temp}.fileType,"; done

其中,mv为操作符

具体使用案例:

void move_all_temp2file(char* filePath ,char* fileType)
{
char paramCache[1024] = {0};
sprintf(paramCache,"%s%s%s%s%s%s%s%s%s","for i in ",filePath,"*.",fileType,".temp; do mv -vf \"$i\" \"${i%.",fileType,".temp}.",fileType,"\"; done");
printf("\n\n move_all_temp2file == [%s]\n\n",paramCache);
system(paramCache);
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值