Created
March 25, 2015 04:35
-
-
Save hafuu/bc141a78864abf75823d to your computer and use it in GitHub Desktop.
指定したディレクトリ配下のタイムスタンプをリセットするスクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open System | |
| open System.IO | |
| let rec resetDirectory (timestamp: DateTime) path = | |
| printfn "%s" path | |
| Directory.SetCreationTime(path, timestamp) | |
| Directory.SetLastAccessTime(path, timestamp) | |
| Directory.SetLastWriteTime(path, timestamp) | |
| Directory.GetFiles(path) |> Array.iter (resetFile timestamp) | |
| Directory.GetDirectories(path) |> Array.iter (resetDirectory timestamp) | |
| and resetFile (timestamp: DateTime) path = | |
| File.SetCreationTime(path, timestamp) | |
| File.SetLastAccessTime(path, timestamp) | |
| File.SetLastWriteTime(path, timestamp) | |
| let root = fsi.CommandLineArgs.[1] | |
| let timestamp = DateTime.Parse(fsi.CommandLineArgs.[2]) | |
| printfn "root: %s, timestamp: %A" root timestamp | |
| resetDirectory timestamp root | |
| printfn "done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment