-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathmain.swift
38 lines (31 loc) · 962 Bytes
/
main.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// main.swift
// FileFinder
//
// Created by Jackie Meggesto on 1/26/16.
// Copyright © 2016 Jackie Meggesto. All rights reserved.
//
import Foundation
import Foundation
func findFile(name: String, atPath: String) -> String {
let fileManager = NSFileManager.defaultManager()
let contents =
try! fileManager.contentsOfDirectoryAtPath(atPath)
for fileOrDir in contents {
var isDir = ObjCBool(false);
let fullPath = atPath + "/" + fileOrDir
let exists = fileManager.fileExistsAtPath(fullPath, isDirectory: &isDir)
if exists && Bool(isDir) {
// YOUR CODE HERE
print("DIR: " + fileOrDir)
} else if exists {
// YOUR CODE HERE
print("FILE: " + fileOrDir)
} else {
print("NEITHER: " + fileOrDir)
}
}
return "NOT FOUND"
}
// print(findFile("APITest.py", atPath: "/Users/jackiemeggesto/Documents"))
print(UINT64_MAX)