+ Post New Thread
Results 1 to 5 of 5
Scripts Thread, Batch File to delete files. in Coding and Web Development; Hi, I am trying to create a batch file to delete all the desktop.ini files from student home areas. I ...
  1. #1

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,392
    Thank Post
    797
    Thanked 1,588 Times in 1,391 Posts
    Blog Entries
    10
    Rep Power
    427

    Batch File to delete files.

    Hi,

    I am trying to create a batch file to delete all the desktop.ini files from student home areas. I have this code.

    Code:
    del /F /S "D:\Shared Folders\StudentHomeAreas\desktop.ini"
    it seems to get rid of some of them but most remain. Does anyone have any thoughts please?

    Thanks

  2. #2

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,656
    Thank Post
    324
    Thanked 506 Times in 474 Posts
    Rep Power
    177
    Quote Originally Posted by FN-GM View Post
    Hi,

    I am trying to create a batch file to delete all the desktop.ini files from student home areas. I have this code.

    Code:
    del /F /S "D:\Shared Folders\StudentHomeAreas\desktop.ini"
    it seems to get rid of some of them but most remain. Does anyone have any thoughts please?

    Thanks
    Have you checked if it's giving you a yes/no to delete? I know force should stop it, but might be worth trying it with a /Q

    Also the ones that aren't deleting do they have indexing enabled on them?

    Steve

  3. #3


    Join Date
    Mar 2009
    Location
    Leeds
    Posts
    6,210
    Thank Post
    218
    Thanked 812 Times in 694 Posts
    Rep Power
    274
    perhaps the ones it leaves are open otherwise locked?
    what about doing something like havnt tested just thiking out loud

    dir /b/s D :\Shared Folders\StudentHomeAreas\desktop.ini >d:\todelete.txt
    for /f %%u in (todelete.txt) do (del %%u )

  4. #4

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,392
    Thank Post
    797
    Thanked 1,588 Times in 1,391 Posts
    Blog Entries
    10
    Rep Power
    427
    Ah im aving a bad day, this did the trick. Typical as soon as i post here i get it sused!

    Code:
    del /F /S /A S "D:\Shared Folders\StudentHomeAreas\desktop.ini"

  5. Thanks to FN-GM from:

    jamiet147 (15th October 2012)

  6. #5

    Join Date
    Mar 2011
    Location
    Yorkshire
    Posts
    6
    Thank Post
    0
    Thanked 2 Times in 2 Posts
    Rep Power
    0
    It might be some of the ini files are hidden or system
    you might need to use attrib to unhide them or mark them as non system before deleting

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 2
    Last Post: 23rd March 2011, 01:55 PM
  2. Need help with batch files please!
    By richrad_mills in forum Windows
    Replies: 13
    Last Post: 23rd June 2010, 07:24 PM
  3. CMD and batch files
    By Aaron in forum Windows Server 2008
    Replies: 6
    Last Post: 1st February 2010, 03:18 PM
  4. Batch File (select random file) help
    By fil_b in forum Windows Server 2000/2003
    Replies: 5
    Last Post: 5th November 2009, 04:13 AM
  5. numbers and batch files
    By russdev in forum Windows
    Replies: 4
    Last Post: 19th November 2005, 09:51 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
  •