Security Forums
Log in
FAQ
| Search
| Usergroups
| Profile
| Register
| RSS
| Posting Guidelines
| Recent Posts
Special offer!
TechGenix and SolarWinds have partnered to provide a fully-functional, free 21-day trial version of SolarWinds ipMonitor, the WindowsNetworking.com Readers' Choice Award Winner for monitoring applications, servers, and network devices to all visitors who join Security Forums. Sign up to Security Forums and get your copy today! Existing members can pick up a copy from the Members Area.
| View previous topic :: View next topic |
| Author |
Message |
moshiur Just Arrived


Joined: 15 May 2008 Posts: 4

|
Posted: Thu May 15, 2008 8:39 pm Post subject: Delete all files/drectories older than 30 Days from a folder |
|
|
I am using the forfiles.exe version:5.2.3790.0 (srv03_rtm.030324-2048) in windowsXP.
I tested the following command in batch file
-------------------------------------------------
| Quote: |
@ECHO OFF
ECHO ******www.moshiur.com***********
forfiles /p C:\test22\test2\ /s /m *.* /d -30 /c "cmd /c del echo @FILE"
EXIT |
-------------------------------------------------
I found that it was working fine including all files in sub directories in my given path but thing is that it couldn't delete any subdirectories from this path C:\test22\test2\ . Do you have any advice ?
|
|
| Back to top |
|
 |
delcom5 New Member

Joined: 07 Jul 2005 Posts: 26

|
Posted: Tue Jun 10, 2008 7:53 am Post subject: |
|
|
Dude,
try cmd line rd ot uppercase S.
|
|
| Back to top |
|
 |
moshiur Just Arrived


Joined: 15 May 2008 Posts: 4

|
Posted: Sat Jul 26, 2008 7:50 am Post subject: Delete all files/drectories older than 30 Days from a folder |
|
|
| Quote: |
| try cmd line rd ot uppercase S. |
Hi delcom5 ! I think you didn't understand what i was trying to do. Let me understand you 1st.
If any files age is more than 30 days , I want to delete automatically those files from the particular folder after 30 days. I need that type of command in script so that I can create a batch file for schedule
I found after research that Forfiles.exe is the best solution for that. Command line rd is able to delete all in directories /subdirectories but does not suitable for my requirements.
| Quote: |
RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path
/S Removes all directories and files in the specified directory
in addition to the directory itself. Used to remove a directory
tree.
/Q Quiet mode, do not ask if ok to remove a directory tree with /S
|
So you may think about it more !!!!
Best Regards,
Moshiur Rahman Khan
www.moshiur.com
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|