Question Locked

Batch Deleting

0 helpful
14 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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

14 replies

by Member 25348569

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

by bizzo

For a full list of switches, run the command

del /?

by tonythetiger

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.

by mamies

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

by rob miners

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

by mamies

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

by rob miners

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

by jruby

Use this type of line in your batch file:

IF NOT EXIST Image.jpg DEL Image2.jpg

by mamies

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

by mamies

Microsoft thought that stupid idea up

by rob miners

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.

This discussion is closed to new replies.