Page 1 of 1

Scan a directory (and sub-directories) and delete some files

Posted: 04 Oct 2010 22:15
by ssaucsw
Hi Guys,

I use a central NAS system at home. I have two computers connecting to it. One is a Windows 7 machine, and the other is a MacBook Pro.

Whenever I add to or browse the NAS, it leaves hidden folders called ".AppleDouble" which is hidden, and sometimes a file called ".DSSTORE" or something-or-rather.

I was after a batch file which scans a main directory folder and its sub-directories. ie "z:\school work" (which has sub-directories like "mathematics, english, etc" and delete any ".AppleDouble" files located in any folder.

Is this possible?

Kind regards, and thanks in advance

Re: Scan a directory (and sub-directories) and delete some f

Posted: 04 Oct 2010 22:53
by amel27

Code: Select all

del /f/s/q/ah "z:\school work\.AppleDouble"

Re: Scan a directory (and sub-directories) and delete some f

Posted: 05 Oct 2010 03:01
by ssaucsw
Hi amel27,

Thanks for your quick reply.

Does that piece of code scan all sub-directories as well as the main directory? Sorry if it seems obvious, but I'm a bit rusty when it comes to batch/dos files.. Haven't played around with them in about 10 years.

So in other words:
Z:\school work\.AppleDouble
Z:\school work\maths\.AppleDouble
Z:\school work\english\.AppleDouble
etc..?

And also, would the script terminate if it scans a file and does not find the .AppleDouble file? Or would it just continue?

Thanks again..

Re: Scan a directory (and sub-directories) and delete some f

Posted: 05 Oct 2010 03:21
by amel27
yes, switch /s enable search selected file in root folder and subfolders, switch /h find only hidden files... if hidden attribute may set or not, command syntax:

Code: Select all

del /f/s/q/a "z:\school work\.AppleDouble"