• RSS
  • Twitter
  • FaceBook

Security Forums

Log in

FAQ | Search | Usergroups | Profile | Register | RSS | Posting Guidelines | Recent Posts

Delete all files/drectories older than 30 Days from a folder

Users browsing this topic:0 Security Fans, 0 Stealth Security Fans
Registered Security Fans: None
Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Exchange 2000 // 2003 // 2007 & Active Directory

View previous topic :: View next topic  
Author Message
moshiur
Just Arrived
Just Arrived


Joined: 15 May 2008
Posts: 0


Offline

PostPosted: Thu May 15, 2008 8:39 pm    Post subject: Delete all files/drectories older than 30 Days from a folder Reply with quote

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
View user's profile Send private message MSN Messenger
delcom5
Just Arrived
Just Arrived


Joined: 07 Jul 2005
Posts: 0


Offline

PostPosted: Tue Jun 10, 2008 7:53 am    Post subject: Reply with quote

Dude,
try cmd line rd ot uppercase S.
Back to top
View user's profile Send private message
moshiur
Just Arrived
Just Arrived


Joined: 15 May 2008
Posts: 0


Offline

PostPosted: Sat Jul 26, 2008 7:50 am    Post subject: Delete all files/drectories older than 30 Days from a folder Reply with quote

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 !!!!Laughing

Rolling Eyes

Best Regards,

Moshiur Rahman Khan
www.moshiur.com Exclamation
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   

Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Exchange 2000 // 2003 // 2007 & Active Directory All times are GMT + 2 Hours
Page 1 of 1


 
Jump to:  
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

Community Area

Log in | Register