Question

  • Creator
    Topic
  • #2148603

    Batch Deleting

    Locked

    by mamies ·

    Hi
    I have a problem with the tildy files that are left on the network drive and they wont disapear when you close the document. At the moment i need to search all of these files and delete them.

    Although i was thinking of creating a batch process then putting in scheduled tasks to automatically delete the files.

    I have no idea what to write in the batch file. If any one can help it is greatly appreciated.

    Note. The files a spread out in hundreds of folders so a simple del ~*.* wont work

    Cheers
    Matthew

All Answers

  • Author
    Replies
    • #2458018

      Clarifications

      by mamies ·

      In reply to Batch Deleting

      Clarifications

    • #2457978

      Omit the * after ~. Write it as [i]del ~.*. [/i]

      by sleepin’dawg ·

      In reply to Batch Deleting

      .

    • #2457938

      This should work

      by neilb@uk ·

      In reply to Batch Deleting

      del /s /q /f ~*.*

      The S switch does subdirectories, the F switch does a Force and the Q switch says “don’t ask”.

      I presume that you’re deleting office temp files. You have the problem on a network drive, though, that the first time it encounters a tmp file that’s open because one of your users has the corresponding document open, it will stop.

      Worth a try, though, in case your users are better behaved than mine.

      Neil 😀

      • #2457156

        Switches

        by mamies ·

        In reply to This should work

        What does the force switch do??

        • #2457104

          Force deletes read-only files

          by bizzo ·

          In reply to Switches

          For a full list of switches, run the command

          del /?

      • #2457000

        FOR /R

        by tonythetiger ·

        In reply to This should work

        should get around the stop.

        FOR /R %%f in (~*.*) DO DEL %%f /F /Q

        when the del command runs into a file it can’t delete, it will quit, then the for will go to the next file in the set.

        • #2458990

          Deleting files

          by mamies ·

          In reply to FOR /R

          Hi yes i would like it to stop if it runs into a file it cant use. This is because it is being used for more then the tildy files and if it is stopped then these files are being used by staff and therefore dont want them deleted.

          Although seeming you know alot about this i would like it to see if there is a specific file in the folder before it deletes this file. Such as search for image.jpg and if it is there dont delete image2.jpg

          Cheers

        • #2458984

          Why don’t you run your

          by rob miners ·

          In reply to Deleting files

          file at logon and not when the files are in use. Problem solved.

        • #2458939

          reply

          by mamies ·

          In reply to Why don’t you run your

          because they are a seperate file that are used to backup recent projects. (recent projects come and go alot so there end up being heaps everywhere). and i can delete these files but they just delete the backup and if something happens. POOF all my data is gone

        • #2458925

          Tell them

          by rob miners ·

          In reply to reply

          to stop saving the files with a ` “tilde”. Who was the wanker that thought that one up.

        • #2458574

          Microsoft

          by mamies ·

          In reply to Tell them

          Microsoft thought that stupid idea up

        • #2458573

          Are you saying

          by rob miners ·

          In reply to Tell them

          that you are relying on temp files as a backup.

          Wouldn’t it be easier to get the staff to save them as a real backup. EG: tmp’filename.doc’ it would help to distinguish them from the temp files.

        • #2458769

          Delete only if a particular file doesn’t exist:

          by jruby ·

          In reply to Deleting files

          Use this type of line in your batch file:

          IF NOT EXIST Image.jpg DEL Image2.jpg

        • #2458575

          Unknown Particular file

          by mamies ·

          In reply to Delete only if a particular file doesn’t exist:

          The particular file is unknown tho. I do not know what the file names are so am unable to do this, There are also multiple files and when i say multiple i mean hundreds of these files and they always end up in a differant place. Very annoying

          BTW this is not a backup. I want to delete the backups that an application uses. We have our backups on another drive but the program keeps creating more so i want to delete them automatically because they use HEAPS of space

Viewing 2 reply threads