
    proc rename { args } {
	set options {
	    {help "command help"}
	}
	array set params [::xsdb::get_options args $options 0]
	if { $params(help) } {
	    return [help tfile [lindex [split [lindex [info level 0] 0] ::] end]]
	}

	if { [llength $args] != 2 } {
	    error "wrong # args: should be \"old new\""
	}

	set chan [::xsdb::getcurchan]
	set oldpath [lindex $args 0]
	set newpath [lindex $args 1]
	::tcf::send_command $chan FileSystem rename ss e [list $oldpath $newpath]
	return ""
    }
    namespace export rename
    ::xsdb::setcmdmeta {tfile rename} categories {tfile}
    ::xsdb::setcmdmeta {tfile rename} brief {Rename path}
    ::xsdb::setcmdmeta {tfile rename} description {
SYNOPSIS {
    tfile rename <old path> <new path>
        Rename file or directory
}
RETURNS {
}
}

    proc readlink { args } {
	set options {
	    {help "command help"}
	}
	array set params [::xsdb::get_options args $options 0]
	if { $params(help) } {
	    return [help tfile [lindex [split [lindex [info level 0] 0] ::] end]]
	}

	if { [llength $args] != 1 } {
	    error "wrong # args: should be \"path\""
	}

	set chan [::xsdb::getcurchan]
	set path [lindex $args 0]
	lindex [::tcf::send_command $chan FileSystem readlink s es [list $path]] 1
    }
    namespace export readlink
    ::xsdb::setcmdmeta {tfile readlink} categories {tfile}
    ::xsdb::setcmdmeta {tfile readlink} brief {Read symbolic link}
    ::xsdb::setcmdmeta {tfile readlink} description {
SYNOPSIS {
    tfile readlink <path>
        Read link file
}
RETURNS {
    Target path
}
}

    proc symlink { args } {
	set options {
	    {help "command help"}
	}
	array set params [::xsdb::get_options args $options 0]
	if { $params(help) } {
	    return [help tfile [lindex [split [lindex [info level 0] 0] ::] end]]
	}

	if { [llength $args] != 2 } {
	    error "wrong # args: should be \"link target\""
	}

	set chan [::xsdb::getcurchan]
	set lpath [lindex $args 0]
	set tpath [lindex $args 1]
	::tcf::send_command $chan FileSystem symlink ss e [list $lpath $tpath]
	return ""
    }
    namespace export symlink
    ::xsdb::setcmdmeta {tfile symlink} categories {tfile}
    ::xsdb::setcmdmeta {tfile symlink} brief {Create symbolic link}
    ::xsdb::setcmdmeta {tfile symlink} description {
SYNOPSIS {
    tfile symlink <old path> <new path>
        Symlink file or directory
}
RETURNS {
}
}

    proc opendir { args } {
	variable files
	set options {
	    {help "command help"}
	}
	array set params [::xsdb::get_options args $options 0]
	if { $params(help) } {
	    return [help tfile [lindex [split [lindex [info level 0] 0] ::] end]]
	}

	if { [llength $args] != 1 } {
	    error "wrong # args: should be \"\[path\]\""
	}

	set chan [::xsdb::getcurchan]
	set path [lindex $args 0]
	set fhandle [lindex [::tcf::send_command $chan FileSystem opendir s es [list $path]] 1]
	dict set files $chan $fhandle offset 0
	return $fhandle
    }
    namespace export opendir
    ::xsdb::setcmdmeta {tfile opendir} categories {tfile}
    ::xsdb::setcmdmeta {tfile opendir} brief {Open directory}
    ::xsdb::setcmdmeta 