jnelsoninjax Posted August 1, 2022 Share Posted August 1, 2022 I have the command in a bat file like this:ForFiles /p "H:\CCTV\video" /s /d -30 /c "cmd /c del /q @file" To clear out any file greater than 30 days old, this seems to work somewhat, but there are 4 sub-folders with in the CCTV folder, and it appears that it seems to be clearing 3 or 4 but it doesn't seem to be doing anything in the 4th, the command is still running, but does not appear to be doing anything else. Is that syntax correct for clearing all folders? Link to comment https://www.neowin.net/forum/topic/1420226-need-help-with-the-forfiles-command/ Share on other sites More sharing options...
+Biscuits Brown MVC Posted August 1, 2022 MVC Share Posted August 1, 2022 Think you need a /s in there after (I think) the /p Link to comment https://www.neowin.net/forum/topic/1420226-need-help-with-the-forfiles-command/#findComment-598751101 Share on other sites More sharing options...
jnelsoninjax Posted August 1, 2022 Author Share Posted August 1, 2022 (edited) On 01/08/2022 at 22:07, Biscuits Brown said: Think you need a /s in there after (I think) the /p Expand OK, I'll add that in and see what happens! It is still ignoring the last folder. The folder structure is Back Door, Back Door 2, Driveway, Front Door The first 3 Back doors and driveway I can see that the most recent file is from July, however in Front Door I have files from 2-19-22 still. So I am confused as to why it is ignoring that folder. Even going to the folder directly and modifying the command to: ForFiles /p /s "H:\CCTV\video\Front Door" /s /d -30 /c "cmd /c del /q @file" does not do anything at all. Edited August 1, 2022 by jnelsoninjax Link to comment https://www.neowin.net/forum/topic/1420226-need-help-with-the-forfiles-command/#findComment-598751106 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now