Timeout & do shell script

How can i run this command for 3 seconds, then quit?

with timeout of 3 seconds
do shell script “fs_usage -ew >/Users/name/Desktop/fs_usage.txt” with administrator privileges
end timeout

How to turn this to POSIX path, so it can be used in that command:
((path to desktop) as string)

I can only answer your second question here


tell application "Finder"
	set foo to quoted form of POSIX path of (path to current user folder) & "Desktop:"
end tell

For the first, you can specify how many bytes to get.

Like this? But this log keeps growing larger and larger.

do shell script "fs_usage -ew B=100 >/Users/name/Desktop/fs_usage.txt" with administrator privileges

Unless fs_usage is giving you something you can’t get from top, I’d be inclined to switch to top -l . As is usual with your questions cirno, you don’t say what you want to do or why you’re doing it this way.

Sorry if i dont explain things enough accurately in my posts.

If i understand “top” correctly, it lists currently open processes, not files. I want to see what files are open to do some troubleshooting.