查找文件类型 [英] finding file type

查看:88
本文介绍了查找文件类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新手......这可能是一个基本问题...


在korn shell脚本中,如何找到文件的类型....这里是伪


if(文件名的类型为.eml或.jpg)然后

---做点什么


thx提前。

I am newbie... this may be a basic question...

In korn shell script, how to find the type of the file.... here is the pseudo

if (filename is of type ".eml" or ".jpg") then
--- do something

thx in advance.

推荐答案


我是新手...这可能是一个基本问题...


在korn shell脚本中,如何找到文件的类型....这里是伪


if(文件名的类型为.eml或.jpg)然后

---提前做某事


thx。
I am newbie... this may be a basic question...

In korn shell script, how to find the type of the file.... here is the pseudo

if (filename is of type ".eml" or ".jpg") then
--- do something

thx in advance.



你有文件名开头吗?你可以发布你的shell脚本吗?

Do you have a filename to begin with? Could you post your shell script thus far?


该目录包含以下文件

.html

.jpg

.css

.js


我只想根据扩展名或某些文件类型逻辑检查.jpg文件。


1)for x in
The directory contains the following files
.html
.jpg
.css
.js

I want only the .jpg files checked based on the extension or some file type logic.

1) for x in


{directory} /*.*

2)if(x endswith .jpg)然后///找到特定类型的文件。

//做点什么


我正在寻找确切的条件(FOR ENDS WITH)如何保持第二行。


thx提前。
{directory}/*.*
2) if (x endswith .jpg) then /// finding a particular type of file.
// do something

I am looking for the exact condition (FOR ENDS WITH) how to keep on the second line.

thx in advance.


这篇关于查找文件类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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