gillwadep Posted March 8, 2014 Posted March 8, 2014 Hi i am trying to write a script using forfiles to delete some files older than 5 days, list what i have delted and output it to a file. but it dosent seem to work here is what i am using. forfiles /p c:\windows\system32\logfiles /s /d-5 /c "cmd /c echo @patH @filE & cmd /c del @file" > c:gill-delte.txt Im not any good at this so any help would be gratefully received. thanks in advance
plexer Posted March 8, 2014 Posted March 8, 2014 Take the echo out and just use the del statement and you'remissing a \ after c: for your log file. Ben
gillwadep Posted March 8, 2014 Author Posted March 8, 2014 Hi thanks ill give that a go. thanks for your help, I though i needed the echo in to make it list content in the file...
plexer Posted March 8, 2014 Posted March 8, 2014 I'd expect that output to come from the del command itself and then you are piping it to a txt file. Not near a pc at the moment so can't test. Ben
bassi2402 Posted July 14, 2014 Posted July 14, 2014 Hi, I want to delete all directories whose name starts with abc and are x days old. I am using forfiles as below but not getting output. Please help : forfiles /p location /m abc* /d -x /c "cmd /c IF @isdir == TRUE rd /Q @path" forfiles /p location /m abc.* /d -x /c "cmd /c IF @isdir == TRUE rd /Q @path"
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