我如何通过循环使用C文件夹中的所有文件? [英] How do I loop through all files in a folder using C?

查看:91
本文介绍了我如何通过循环使用C文件夹中的所有文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从所有的文件名在目录中删除特定的子串:

I want to remove a particular substring from all the file names in a directory:

- 像'XYZ.com从飞出个未来s1e20 - [XYZ.com] .AVI' -

-- like 'XYZ.com' from 'Futurama s1e20 - [XYZ.com].avi' --

所以基本上我需要提供方法,所需子,它通过所有文件名具有循环和比较。

So basically I need to provide the method with a desired substring, and it has to loop through all file names and compare.

我不能在所有文件夹中使用C弄清楚如何循环。

I cant figure out how to loop through all files in a folder using C.

推荐答案

您可以用C使用人3 FTS遍历文件夹中的所有文件:

You may use man 3 fts to loop through all files in a folder using C:

<一个href=\"http://keramida.word$p$pss.com/2009/07/05/fts3-or-avoiding-to-reinvent-the-wheel/\">http://keramida.word$p$pss.com/2009/07/05/fts3-or-avoiding-to-reinvent-the-wheel/

这篇关于我如何通过循环使用C文件夹中的所有文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆