osx: how to write the full path of all directory contents of a folder containing >50k files&folders to a txt

StackOverflow https://stackoverflow.com/questions/9154801

문제

I'm trying to find is a (1.) low risk (no messing with the files), (2.) dependable, (3.) uncomplicated, and (4.) reasonably effective way to write the posix path of every single file and folder in a directory with 50k plus files and folder to a txt. The txt should contain nothing but the paths, one line per path. The order of the files is not particularly important as long as they are all there.

In applescript, you can get the paths of all files and folder in a directory this way:

tell application "Finder"
    set file_list to entire contents of (choose folder with prompt "Please select directory.")
end tell

But this crashes finder when used on the folder in question. There must be some other solution? Or perhaps a way to make the applescript work?

도움이 되었습니까?

해결책

Does this produce the expected output?

find /dir -print > output.txt
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top