Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. set home_path to (path to home folder as text)
  2. set hiddenFile to home_path & ".test"
  3.  
  4. tell application "Finder"
  5. if not (exists file hiddenFile) then
  6. display dialog ".test does not exist."
  7. end if
  8. end tell
  9.  
  10. #!/bin/bash # define the shell, not really needed because bash is the default shell but good practice
  11. cd /path/to/search/directory # cd to the proper place
  12. ls -a | grep "the text you're looking for" # list all files (including hidden ones) and pipe output into grep, a search tool
  13.  
  14. chmod +x /path/to/findFile.sh
  15.  
  16. set output to do shell script "/path/to/findFile.sh"
  17.  
  18. set home_path to (path to home folder as text)
  19. set hiddenFile to home_path & ".test"
  20.  
  21. tell application "System Events"
  22. if not (exists file hiddenFile) then
  23. display dialog ".test does not exist."
  24. else
  25. display dialog ".test does exist."
  26. end if
  27. end tell
  28.  
  29. set home_path to (path to home folder as text)
  30. set fileName to ".viminfo"
  31. set hiddenFile to home_path & fileName
  32.  
  33. tell application "Finder"
  34. if not (exists file hiddenFile) then
  35. try
  36. set output to do shell script "[ -f " & quoted form of POSIX path of hiddenFile & " ];"
  37. on error
  38. display dialog fileName & " does not exist."
  39. end try
  40. display dialog fileName & " does exist."
  41. end if
  42. end tell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement