+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 28
How do you do....it? Thread, delete same folder from all users home area in Technical; hi everyone i have a folder in everyones user area that i need to delete in one go could anyone ...
  1. #1
    markcuk's Avatar
    Join Date
    Sep 2005
    Posts
    586
    Thank Post
    29
    Thanked 60 Times in 55 Posts
    Rep Power
    38

    delete same folder from all users home area

    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

  2. #2

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,599
    Thank Post
    109
    Thanked 765 Times in 596 Posts
    Rep Power
    181

    Re: delete same folder from all users home area

    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

  3. #3
    markcuk's Avatar
    Join Date
    Sep 2005
    Posts
    586
    Thank Post
    29
    Thanked 60 Times in 55 Posts
    Rep Power
    38

    Re: delete same folder from all users home area

    hi ric

    i like the sound option of option 3! but do you have a script i could use

    thanks

    mark

  4. #4

    Join Date
    Mar 2007
    Posts
    323
    Thank Post
    6
    Thanked 7 Times in 6 Posts
    Rep Power
    17

    Re: delete same folder from all users home area

    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

  5. #5

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,599
    Thank Post
    109
    Thanked 765 Times in 596 Posts
    Rep Power
    181

    Re: delete same folder from all users home area

    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

  6. #6
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    5,011
    Thank Post
    120
    Thanked 282 Times in 260 Posts
    Rep Power
    108

    Re: delete same folder from all users home area

    WMI query is good for this.

  7. #7

    Join Date
    Feb 2006
    Location
    Derbyshire
    Posts
    1,381
    Thank Post
    181
    Thanked 211 Times in 171 Posts
    Rep Power
    65

    Re: delete same folder from all users home area

    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

  8. #8
    apeo's Avatar
    Join Date
    Sep 2005
    Location
    Lost
    Posts
    1,612
    Thank Post
    95
    Thanked 115 Times in 111 Posts
    Rep Power
    42

    Re: delete same folder from all users home area

    Nice bat script, much less complicated then the vbscript i was thinking of.

  9. #9

    Join Date
    Oct 2005
    Location
    Wakefield, UK
    Posts
    51
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Re: delete same folder from all users home area

    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.

  10. #10

    Join Date
    Feb 2006
    Location
    Derbyshire
    Posts
    1,381
    Thank Post
    181
    Thanked 211 Times in 171 Posts
    Rep Power
    65

    Re: delete same folder from all users home area

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

  11. #11

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    17,800
    Thank Post
    517
    Thanked 2,469 Times in 1,913 Posts
    Blog Entries
    24
    Rep Power
    835

    Re: delete same folder from all users home area

    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.

  12. #12

    Join Date
    Nov 2006
    Posts
    547
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: delete same folder from all users home area

    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

  13. #13

    Join Date
    Oct 2005
    Location
    Wakefield, UK
    Posts
    51
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Re: delete same folder from all users home area

    Quote Originally Posted by OutToLunch
    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.

  14. #14

    Join Date
    Feb 2006
    Posts
    1,187
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: delete same folder from all users home area

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

  15. #15

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,156
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124

    Re: delete same folder from all users home area

    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.

SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Home Area Permissions
    By DSapseid in forum Scripts
    Replies: 15
    Last Post: 21st May 2012, 01:27 PM
  2. Delete a folder using scripting
    By FN-GM in forum Scripts
    Replies: 15
    Last Post: 22nd December 2007, 04:44 PM
  3. Users Home Folder and Network Drive
    By lovelldr in forum Windows
    Replies: 6
    Last Post: 6th August 2007, 10:17 AM
  4. Replies: 3
    Last Post: 27th April 2007, 08:32 AM
  5. Got a folder I cannot delete or take ownership of
    By sidewinder in forum Windows
    Replies: 2
    Last Post: 20th March 2007, 02:49 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •