In this paper we attempt to answer the question, how formation of a small-scale trench in the Martian regolith affects local distribution of the subsurface ice. We are especially interested in the consequences of digging a trench to search for buried ice, as has been done during the Phoenix Mars Lander mission. However, the results may be also applicable for natural troughs, or cracks. We present results of simulations of diurnal exchange of water between the regolith and the atmosphere. Our model includes the heat and vapor migration in the regolith surrounding the trench, as well as formation of diurnal frost. We take into account scattering of light in the atmosphere and on the trench facets, as well as changes of atmospheric humidity on diurnal and seasonal time scales. Our calculations show, that the measurements of ice content in a sample obtained within one, or two days from the beginning of digging should not be affected. However, on somewhat longer time scale at the south facing site of the trench the regolith can be significantly depleted from ice. This effect should be taken into account if the excavation and taking samples from different depths will be performed in stages separated in time by a month, or more.