|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Delete Folder Contents Automatically
Hi
I'm running Win XP Pro SP2 and have a security cam recording video to a folder on a daily basis. The obvious problem is that after a few days there is very little disk space left and I need to manually delete the contents of the cam's folder. I,ve written a simple .bat file to do the delete automatically. See below Code:
<cam.bat> @echo off del/s/q\c:\recorded_Video exit <cam.bat> When I run the file I get no errors but the files within the folder are not deleted. ViRi |
|
#2
|
|||
|
|||
|
Ive got a similar problem. Looking for a script that can delete folders when the free disk space is below x.
Now my recorder store the files in c:\sec\07-01-01 c:\sec\07-01-02 and so on... |
|
#3
|
||||
|
||||
|
--moved to the Windows Scripting forum.
ViRi, remove the first line from your code.. what is the output? |
|
#4
|
||||
|
||||
|
Put a space between del and /s and between each attribute. Drop the extra \ too. Your script will run, but it will error out on the del command. With echo turned off you won't see this. Unfortunately, even though it doesn't complete the del command, the batch file still returns an error code of 0.
Code:
cam.bat
@echo off del /s /q c:\recorded_Video\*.* exit
__________________
Click the image if at any point you don't like my decision.Scripting problems? Windows questions? Ask the Windows Guru! |
|
#5
|
|||
|
|||
|
Quote:
Hi I've removed the first line and changed the second line to del / q c:\recorded_video and it works fine it will delete all the files it finds in c:\recorded_video Now I overlooked the fact that my recorded video files are not actually stored in c:\recorded_video but in c:\Documents and Settings\My Documents\ViRiPuff\recorded_video I've tried running the same script with the new path and nothing happens no files are deleted del / q c:\Documents and Settings\My Documents\ViRiPuff\recorded_video ViRi <cam.bat> del / q c:\recorded_Video exit <cam.bat> |
|
#6
|
||||
|
||||
|
That's because your file path now contains spaces. You need to enclose it in quotes. And don't forget the *.*
Code:
cam.bat
@echo off del /q "c:\Documents and Settings\My Documents\ViRiPuff\recorded_video\*.*" exit |
![]() |
| Viewing: ASP Free Forums > System Administration > Windows Scripting > Delete Folder Contents Automatically |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|