您现在的位置:首页 >> 自然生态

一道有趣的大厂检验面试题,你能用 Python or Shell 解答吗?

时间:2023-03-13 12:17:46

boolean result = false; if(pathname.isFile()) { String path = pathname.getAbsolutePath().toLowerCase(); if(path.lastIndexOf(".jpg")> -1 || path.lastIndexOf(".png")> -1 || path.lastIndexOf(".jpeg")> -1 || path.lastIndexOf(".bmp")> -1) { result = true; } } else { result = false; } return result; } }); for(File image : images) { copyImagesHelper(image, to); } File[] dirs = from.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.isDirectory(); } }); for(File dir : dirs) { copyImages(from, to); } } private void copyImagesHelper(File image, File dir) throws IOException { String cmd = String.format("cp %s %s", image.getAbsolutePath(), dir.getAbsolutePath()); Runtime runtime = Runtime.getRuntime(); runtime.exec(cmd); }

Shell 题目(by 杰)

find ./A/ -maxdepth 2 -name '*.jpg' -exec cp {} ./B ;

你好呀,喜欢这篇文章的话烦请点个“赞”哦!万分感谢~(1]▽1]) PS:有疑问可以联系我们哦 更多技术文章个人和免费资料领取

_id=qrcodeBellfrom=souhuBelltimestamp=1652425107Bellauthor=QY。

南京哪家医院治早泄阳痿好
骨关节炎吃什么药止痛好
西安医院哪家男科医院好
贵阳甲状腺医院去哪家好
重庆看牛皮癣哪家好
相关阅读