Batch command for deleting both folders and contents order than 30 days
Solved/Closed
                    
        
                    gmwenechanya
    
        
                    Posts
            
                
            2
                
                            Registration date
            Saturday February  1, 2020
                            Status
            Member
                            Last seen
            February  3, 2020
            
                -
                            Feb  1, 2020 at 01:32 PM
                        
David Webb Posts 3177 Registration date Monday November 25, 2019 Status Administrator Last seen May 15, 2023 - Feb 3, 2020 at 09:45 AM
        David Webb Posts 3177 Registration date Monday November 25, 2019 Status Administrator Last seen May 15, 2023 - Feb 3, 2020 at 09:45 AM
        Related:         
- Batch script to delete folders older than 30 days
- Batch script to delete files in a folder older than 30 days - Best answers
- Batch delete folder - Best answers
- Skype last seen days ago - Guide
- Tech gifts under $30 - Home - Buying guides
- 554*30 - Yahoo Mail Forum
- You can't access certain settings for a few days - Instagram Forum
- Batch copy folder ✓ - Programming Forum
1 response
                    
        
                    David Webb
    
        
                    Posts
            
                
            3177
                
                            Registration date
            Monday November 25, 2019
                            Status
            Administrator
                            Last seen
            May 15, 2023
            
         
            
                    6,928
    
    
                    
Updated on Feb 1, 2020 at 05:08 PM
    Updated on Feb 1, 2020 at 05:08 PM
                        
                            
                    Hello, a similar question was asked and answered in this forum post. 
The best answer was the following:
Try the following command to automatically delete files at the root of a directory. This command can be saved in a .bat file and scheduled with scheduled tasks.
forfiles /p "PATH" /s /d -30 /c "cmd /c del @file : date >= 30 days >NUL"
Change "PATH" with the path where you want the files to be deleted. If there are no spaces in the path you dont need the "-symbol.
Let me know if that helps!
 
                
                
    The best answer was the following:
Try the following command to automatically delete files at the root of a directory. This command can be saved in a .bat file and scheduled with scheduled tasks.
forfiles /p "PATH" /s /d -30 /c "cmd /c del @file : date >= 30 days >NUL"
Change "PATH" with the path where you want the files to be deleted. If there are no spaces in the path you dont need the "-symbol.
Let me know if that helps!
    David Webb
    
                             
                    
    
        Content Editor and Community Manager - CCM.net
 
        
    
    
    
    
Feb 3, 2020 at 09:01 AM
Feb 3, 2020 at 09:45 AM