Jelajahi Sumber

first commit

Clemsim 2 tahun lalu
melakukan
3918dc169c
4 mengubah file dengan 34 tambahan dan 0 penghapusan
  1. 1 0
      .gitignore
  2. 7 0
      Cargo.lock
  3. 8 0
      Cargo.toml
  4. 18 0
      src/main.rs

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+/target

+ 7 - 0
Cargo.lock

@@ -0,0 +1,7 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "crawler1"
+version = "0.1.0"

+ 8 - 0
Cargo.toml

@@ -0,0 +1,8 @@
+[package]
+name = "crawler1"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]

+ 18 - 0
src/main.rs

@@ -0,0 +1,18 @@
+use std::fs;
+use std::path::Path;
+
+fn main() {
+    let dir_path = "E:\\Users\\cleme\\Downloads";
+    recursive(dir_path)
+}
+fn recursive<P: AsRef<Path>>(path: P) {
+    if let Ok(entrie) = fs::read_dir(path) {
+        for entry in entrie{
+            if let Ok(entry_ok) = entry {
+                if let Ok(file_type) = entry_ok.file_type() {
+                    println!("{:?} : {:?}",entry_ok.path(), file_type.is_dir())
+                }
+            }
+        }
+    }
+}