applescript 只获取文件夹的文件名 [英] applescript get only file name of a folder

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

问题描述

我有以下脚本列出文件夹的内容(文件和文件夹)

I have the following script that list the contents (files and folder) of a folder

 set the_files to (list folder (choose folder) without invisibles)

例如文件夹根有一个文件 text1.txt 和文件夹 subroot2 和 subroot3

e.g folder root has a file text1.txt and folders subroot2 and subroot3

但是我怎样才能获得文件夹根目录的文件名(只有 text1.txt)(不包括 subroot2 和 subroot3)?谢谢

but how can I get just the file name (only text1.txt) of a folder root (exclude subroot2 and subroot3)? thanks

推荐答案

tell application "Finder"
    files of folder (choose folder) -- Finder file objects
    name of files of folder (choose folder) -- names of files
end tell

这篇关于applescript 只获取文件夹的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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