﻿<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
   <CodeSnippet Format="1.0.0">
        <Header>
            <Title> Move a file </Title>
            <Description> Expansion snippet to move a file. </Description>
            <Author>Microsoft Corporation</Author>
            <SnippetTypes>          
                <SnippetType> Expansion </SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID> FileName </ID>
                    <Default> strFileName </Default>
                    <ToolTip> Variable to hold the name of the file to be moved. </ToolTip>
                </Literal>
        <Literal>
                    <ID> DirName </ID>
                    <Default> strDirName </Default>
                    <ToolTip> Folder name to which the file is to be moved </ToolTip>
                </Literal>
            </Declarations>
            <Code Language="vjsharp" Format="CData"><![CDATA[
boolean flStatus = false;  //variable is set to true if file is moved successfully else false

//Check if the file name and directory names are not null and not blank
if (($FileName$ != null && $FileName$.length() > 0) &&
    ($DirName$ != null && $DirName$.length() > 0))
{
    java.io.File objFile = new java.io.File($FileName$);
    java.io.File objDir = new java.io.File($DirName$);
    flStatus = objFile.renameTo(new java.io.File(objDir, objFile.getName()));
}
$selected$ $end$
]]>
</Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>
