Team System Developer Center >
Visual Studio Team System Forums
>
Team Foundation Server - Administration
>
TFS Delete folder without a workspace
TFS Delete folder without a workspace
- Hi,
I have a couple of folders in my TFS Server which I want to delete . I'am aware this is possible when your workspace has this folder downloaded to your local machine. But I want to delete a folder in TFS directly when it is not available in your workspace . I'am trying to do this through Team Explorer in Visual Studio or through the command line utility TF.exe . In Team Explorer , when I right click this folder , the "Delete" option is grayed out . When I do this through the utility I get the error "No matching items found in XYZ in your workspace".
I really dont want to get the latest to my workspaces as we have plenty of Release folders that needs to be deleted and this will consume lot of disk space.
Is there a way to do it.
Thanks,
Suresh
Answers
- Hi Suresh,
Thanks for reporting this issue.
I am afraid that it is mandatory that the folder must be in local workspace before deleting.
Here is a workaround to prevent disk space consumption:
Instead of getting latest in Team Explorer, execute "tf get <folder path>" without /recursive switch. By doing this the command will only get the top level files under the folder but all the subfolder's files will be ignored. Then after the folder is in the workspace, you can delete it.
Hope it helps.
Hongye Sun [MSFT]
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg @ microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer bySuresh Gladstone Monday, November 02, 2009 8:29 PM
- Hi Suresh,
This can be caused if there is any unversioned file in the folder, or any path is in use by other process.
The error occurs when TFS is going to delete the local folder. However, if there is some unversioned file or any file can't be deleted, windows will report this error.
The folder will be deleted correctly in server. When you perform a Get operation next time, TFS will try to delete the local folder again.
If there is no unversioned file, you can do a test to delete the local folder by yourself.
Hope it helps.
Hongye Sun [MSFT]
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg @ microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer bySuresh Gladstone Monday, November 02, 2009 8:30 PM
All Replies
- Hi Suresh,
Thanks for reporting this issue.
I am afraid that it is mandatory that the folder must be in local workspace before deleting.
Here is a workaround to prevent disk space consumption:
Instead of getting latest in Team Explorer, execute "tf get <folder path>" without /recursive switch. By doing this the command will only get the top level files under the folder but all the subfolder's files will be ignored. Then after the folder is in the workspace, you can delete it.
Hope it helps.
Hongye Sun [MSFT]
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg @ microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer bySuresh Gladstone Monday, November 02, 2009 8:29 PM
- Hi Hongye Sun,
Thanks a lot. This saved us hours of work in getting the latest to a local machine . Now , I have a simple script which first does a "TFS Get" and then does a "TFS DELETE" . It works for the most cases . But very rarely I find the message "xyz folder cannot be deleted because it is not empty" . The Delete still succeeds and I'am able to check-in the deleted folder . Want to know if this is an issue.
I've used both recursive and non-recursive options for the delete , but still get this message.
Thanks,
Suresh - Hi Suresh,
This can be caused if there is any unversioned file in the folder, or any path is in use by other process.
The error occurs when TFS is going to delete the local folder. However, if there is some unversioned file or any file can't be deleted, windows will report this error.
The folder will be deleted correctly in server. When you perform a Get operation next time, TFS will try to delete the local folder again.
If there is no unversioned file, you can do a test to delete the local folder by yourself.
Hope it helps.
Hongye Sun [MSFT]
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg @ microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer bySuresh Gladstone Monday, November 02, 2009 8:30 PM


