markcuk Posted April 23, 2007 Posted April 23, 2007 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
Ric_ Posted April 23, 2007 Posted April 23, 2007 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
markcuk Posted April 23, 2007 Author Posted April 23, 2007 hi ric i like the sound option of option 3! but do you have a script i could use thanks mark
techyphil Posted April 23, 2007 Posted April 23, 2007 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
Ric_ Posted April 23, 2007 Posted April 23, 2007 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
OutToLunch Posted April 24, 2007 Posted April 24, 2007 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
apeo Posted April 24, 2007 Posted April 24, 2007 Nice bat script, much less complicated then the vbscript i was thinking of.
disinfo Posted April 24, 2007 Posted April 24, 2007 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.
OutToLunch Posted April 24, 2007 Posted April 24, 2007 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...
localzuk Posted April 24, 2007 Posted April 24, 2007 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.
bishopsgarthstockton Posted April 24, 2007 Posted April 24, 2007 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
disinfo Posted April 24, 2007 Posted April 24, 2007 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... I just find that Linux can handle long file names, filenames with special characters in a lot better than what windows can. I have plenty of spare PC's to boot into knoppix, so dont find that a problem.
NetworkGeezer Posted April 24, 2007 Posted April 24, 2007 @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.
srochford Posted April 24, 2007 Posted April 24, 2007 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\ where they just see n:\ Early versions of Robocopy couldn't cope with folders like this but the current one does.
webman Posted April 24, 2007 Posted April 24, 2007 NetworkGeezer: I disagree. There's nothing wrong with using any linux system (non-critical server, workstation, live cd - whatever) - it doesn't take much to mount a samba share and use the power of the command line to get the job done. We had a similar task a while ago trying to remove a load of folders from a network share - Windows kept throwing up messages that aborted it so had to be started again. Mounted on a linux box and a quick 'rm -rfv /mnt/dir/*' had the job done in seconds.
mac_shinobi Posted April 24, 2007 Posted April 24, 2007 Personal preference and comfort zones come to mind, I dont use linux much myself , at least not yet and when it comes to removing stuff and command line in terms of linux, personally I wouldnt be too comfortable with using linux to do it, not saying its not a good way of doing it or its not safe but in the wrong hands could be if you dont know what ya doing although googling it wouldnt be too hard Now that you mentioned that command, I dont spose you have a document or at least point me in the right direction so I can look that one up to see what it does and if it has any other switches etc etc
webman Posted April 24, 2007 Posted April 24, 2007 gecko@linuxbox:~$ man rm I highly recommend the Linux Phrasebook by Scott Granneman
webman Posted April 24, 2007 Posted April 24, 2007 No, just 'pointing him in the direction' as per his last paragraph. I don't have a Tux avatar 8)
mac_shinobi Posted April 24, 2007 Posted April 24, 2007 gecko@linuxbox:~$ man rm I highly recommend the Linux Phrasebook by Scott Granneman Is that downloadable ( If so where do I get it ) if not then I will check that out in a bit on amazon, unless you know somewhere better ?
webman Posted April 24, 2007 Posted April 24, 2007 Dont know if it's downloadable, but its fairly cheap on amazon for what is a good pocket reference. Got a good rating in Linux Format too
mac_shinobi Posted April 24, 2007 Posted April 24, 2007 I found it and I get paid this week so might do that , does that just explain what the commands do or is it more of a dip ya feet in and give you a basic walk abouts on whats what kinda deal or what ?
GrumbleDook Posted April 24, 2007 Posted April 24, 2007 @gecko I've got a boot floppy that will do everything you need ... just stick it in your PC and type fdisk /mbr Trust me ... it'll be fine ;-) (and yes ... I could always build a boot disk for his Mac and applescript trashing volumes ... but I am not that nasty ... I'll leave that to Geoff ;-)!!)
mac_shinobi Posted April 25, 2007 Posted April 25, 2007 could always be worse ...... could always have you in front of the computer , never mind any of that lol
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now