We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 29436

9.2i Tcl - "xfile remove" command does not allow user to remove multiple files using wildcards


Keywords: asterisk, question mark, multiple files, source

[xfile add] allows users to add multiple files and use wildcards in its interface. For example:

%xfile add *.vhd /mydir/*.vhd timing.ucf

However, [xfile remove] does not allow wildcards which forces the user to type out each files explicitly, such:
%xfile remove top.vhd sub1.vhd sub2.vhd /mydir/sub3.vhd /mydir/sub4.vhd


An enhancement to improve the xfile remove command is being considered for a future release. Until then, a user must explicitly name the files to be removed or use a combination of lower-level commands to remove multiple files.

Example 1: All source files in a project can be removed with the following command:
foreach file [search * -type file] {xfile remove [lindex [split $file \/] [expr [llength [split $file \/]]-1]]}

To remove a specific source type, change the search string.
Example 2: To remove all Verilog (.v) files use the following command.
foreach file [search *.v -type file] {xfile remove [lindex [split $file \/] [expr [llength [split $file \/]]-1]]}
AR# 29436
Date Created 10/28/2007
Last Updated 04/17/2009
Status Archive
Type General Article