dotnet / dotnet/dotnet-api-docs

F# Version ??

Open
#824 1 comment 0 reactions 0 assignees View on GitHub
area-System.IO dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

open System
open System.IO

let path = @"c:\temp\MyTest.txt"
let path2 = @"c:\temp\MyTest2.txt"

do
try
if File.Exists(path) |> not then
do use fs = File.Create(path)
()

// Ensure that the target does not exist.
if File.Exists(path2) then
do File.Delete(path2)

// Move the file.
do File.Move(path, path2) |> ignore
Console.WriteLine("{0} was moved to {1}.", path, path2)

// See if the original exists now.
if File.Exists(path) then
do Console.WriteLine("The original file still exists, which is unexpected.")
else
do Console.WriteLine("The original file no longer exists, which is expected.")


with
| e -> Console.WriteLine("The process failed: {0}", e.ToString())

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 1b48b95b-9953-c61c-5d48-252f7da1613c
* Version Independent ID: da547b89-cc27-5fca-a920-88c3c1b8add4
* Content: [File.Move(String, String) Method (System.IO)](https://docs.microsoft.com/en-us/dotnet/api/system.io.file.move?view=netframework-4.7.1#System_IO_File_Move_System_String_System_String_)
* Content Source: [xml/System.IO/File.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.IO/File.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.