+ Post New Thread
Results 1 to 6 of 6
Windows Server 2008 R2 Thread, Deleting Files - "File Not Found" even though it is there in Technical; I'm trying to run a batch script to delete a particular file from everyone's profile - when I run it, ...
  1. #1
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,485
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    75

    Deleting Files - "File Not Found" even though it is there

    I'm trying to run a batch script to delete a particular file from everyone's profile - when I run it, it returns the message that it couldn't find the file, even though it is definitely there. I'm wondering if this is because the file is inside a hidden directory. How can I script the deletion of these files?

  2. #2
    cromertech's Avatar
    Join Date
    Dec 2007
    Location
    Cromer by the coast
    Posts
    731
    Thank Post
    177
    Thanked 109 Times in 97 Posts
    Rep Power
    54
    That will be the reason but there is a way round it

    Code:
     del /A:H {file}
    Should do it

  3. #3

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,446
    Thank Post
    1,438
    Thanked 1,168 Times in 797 Posts
    Rep Power
    707
    Quote Originally Posted by enjay View Post
    I'm trying to run a batch script to delete a particular file from everyone's profile - when I run it, it returns the message that it couldn't find the file, even though it is definitely there. I'm wondering if this is because the file is inside a hidden directory. How can I script the deletion of these files?
    First thing I'd do is dump the file paths to the command line to check you haven't missed out any slashes... that's caught me out a few times and made me feel rather dumb!

  4. #4
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,485
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    75
    The /a:h doesn't work, and the path is definitely good - I've copied it from the batch file and pasted it into Explorer, and it resolves.

  5. #5
    cromertech's Avatar
    Join Date
    Dec 2007
    Location
    Cromer by the coast
    Posts
    731
    Thank Post
    177
    Thanked 109 Times in 97 Posts
    Rep Power
    54
    Am I right in thinking you want to delete all files in a hidden folder? Take a look at this page

    Del - Delete Files
    In particular the following lines

    Folders
    If a folder name is given instead of a file, all files in the folder will be deleted, but the folder itself will not be removed.

  6. #6
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,485
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    75
    No, I want to delete a single (non-hidden) file in a hidden folder. Being specific, it is \\[server]\[user]\AppData\Microsoft\Templates\normal.dot which I want to delete, and the AppData folder is the hidden one.

    My batch file reads:
    del /q /a:h D:\\Users\Staff\[name]\appdata\Microsoft\Templates\normal.dot

    I suppose I could try DEL /F /S /Q %normal.dot% instead, kind of like being able to test these sort of commands first though...

SHARE:
+ Post New Thread

Similar Threads

  1. 404 File Not Found on all files accessed via HAP+
    By enjay in forum Home Access Plus+
    Replies: 7
    Last Post: 27th September 2011, 04:08 PM
  2. ActiveSync synching - File Not Found Error
    By xoAlto in forum Windows
    Replies: 0
    Last Post: 1st December 2009, 12:17 PM
  3. Replies: 22
    Last Post: 19th March 2008, 09:56 AM
  4. Replies: 4
    Last Post: 9th January 2007, 04:03 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
  •