Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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 :)

Posted

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 ;)

Posted

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

Posted

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.

Posted
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...
Posted
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.
Posted
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.

Posted

@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.

Posted

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.

Posted

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.

Posted

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

 

:)

Posted
gecko@linuxbox:~$ man rm

:D

 

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 ?

Posted
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 :)
Posted
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 ?
Posted

@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 ;-)!!)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...