페이지

2009년 5월 29일 금요일

Delete files or folders recursively

I got egiht version of an sample codes having .svn folders and .DS_Store files. I started to delete those two things manually but soon I got tired. So, I got on the internet and found following good tip.

Source: http://www.daniweb.com/forums/thread61479.html#

To do this, create a batch file first and then copy following command to newly created batch file.

REM Following command is desinged to delete folders
FOR /F "tokens=*" %%G IN ('DIR /B /AD /S *.svn*') DO RMDIR /S /Q %%G
REM Following command is design to delete files
FOR /F "tokens=*" %%G IN ('DIR /B /AH /S *.DS_Store*') DO RMDIR /S /Q /AH %%G

Command DIR /B /AD /S *.svn* finds all folder having .svn as its name and the the found folder names are passed to RMDIR /S /Q %%G by FOR /F ~ DO ~. It is also applied to file but need to use different option value.

Good luck to whom to refer this command some day.

댓글 없음: