hi everyone
i have a folder in everyones user area that i need to delete in one go could anyone help me in how i can do it??
the folder is set up like this
d:\pupils\02fredl\folderthatneedsdeleting
i need it to totally delete that folder
thanks
mark
hi everyone
i have a folder in everyones user area that i need to delete in one go could anyone help me in how i can do it??
the folder is set up like this
d:\pupils\02fredl\folderthatneedsdeleting
i need it to totally delete that folder
thanks
mark

Several options exist...
1. Simple find on the folder name in explorer and then select all to delete
2. Edit the login script and add an if exist... del... command
3. A script that goes through the folder d:\pupils recursively and deletes the folder
hi ric
i like the sound option of option 3! but do you have a script i could use
thanks
mark
The way in which i'd do it is...
goto the server and share containing the home folders. Do a search for the folder name you wish to delete within that folder.
E.g. - I got a bollocking for "automating" a task which they was doing manually by deleting a folder called "Profile" that suddenly appeared in the users home folder. 2000 folders we had and a lady was given the task of going one by one removing it. After the 200'th I couldnt bare it andso searched and deleted it.
I got told off for it... totally unfair as they dunt like anything automated inc scheduelled defrags over the holiday. Buy hey ho..
Just find files mate![]()

I may have some script snippets at work but I cannot be arsed remoting in to find them... no offence
The explorer search is by far the laziest option![]()
WMI query is good for this.
Only needs a couple of lines in a batch file to do this - I use it to keep our roaming profiles tidy and get rid of cache folders for various programs etc. Paths are hardcoded for safety, run it from the server you want to clean up.
cd rootdirtoclean
for /D %%I in (*) do rmdir /s /q "E:\rootdirtoclean\%%I\foldertoremove"
so in your case the .bat would be
cd d:\pupils
for /D %%I in (*) do rmdir /s /q "d:\pupils\%%I\folderthatneedsdeleting"
Hope this helps.
B
Nice bat script, much less complicated then the vbscript i was thinking of.
I would use a linux boot cd to do this from knoppix for example.
1. create a mount point and mount your home shares dir.
mkdir /mnt/homeshares
mount -t cifs //fileserver/yoursharename /mnt/homeshares -o username=administrator
2. Using the find command and rm command
find /mnt/homeshares -name "RECYCLER" -exec rm -rf {} \;
This would remove all recycler folders from folders under yoursharename.
Isn't that just using a boot CD for the sake of it? 5 mins to reboot your PC into Knoppix + waiting for the operation to complete while being unable to use your normal Windows install seems a bit OTT... I can understand if you're already working from a Linux install but...

It all depends on which scripting style you are comfortable with. Technically, you should be able to use Cygwin to do what disinfo states - so could use that via windows.
Just do a search for that folder that you wish to delete, point the search to the pupils folder. once all the folder has been found in each persons directory, highlight and delete. no need to do any scripts. easy
I just find that Linux can handle long file names, filenames with special characters in a lot better than what windows can.Originally Posted by OutToLunch
I have plenty of spare PC's to boot into knoppix, so dont find that a problem.
@dsinfo
You can make a good case for runnig Linux in schools e.g. LAMP, DansGuarding/SQUID, IPCop or cheap(er) client PCs.
But this isn't one of them.
Rmdir /s will normally not normally mind about long file names or file names with special characters.
The only time that rd /s won't work with long names is when (eg) a user has drive N: mapped to \\server\share\username and makes a very long file/folder name (typically they do this by typing a long sentence in Word, hit save and accept the default file name - which is the first sentence in the document!)
From the user's point of view the total length is less than the administrator sees - you see (say) d:\home\username\<long name> where they just see n:\<long name>
Early versions of Robocopy couldn't cope with folders like this but the current one does.
There are currently 1 users browsing this thread. (0 members and 1 guests)