Hello
I need help on how to delete files from a particular directory which are older than 24 hours.
please help
Thanks
Pinky
Hello
I need help on how to delete files from a particular directory which are older than 24 hours.
please help
Thanks
Pinky
Dont know how to get it to run at a perticular time but this will do it for you every time you reboot.
1)add this line to your autoexec.bat neer the end
dump.bat (call it whatever.bat its gonna call the batch file you are gonna write.)
2)At the command prompt type "edit dump.bat"
this should give you a blank edit screen.
now add the 2 following lines
deltree /y path eg..(c:\windows\temp)
mkdir path eg..(c:\windows\temp)
**note** where I put path you put the path of the files you want to delete.
**Also note** that this is going to erase any subdirectory`s in the path so be carefull.
Save and exit, and the next time you reboot presto it completely wipes the directory and writes a new one with the same name over it. Works good for my old dos box.
Good Luck!!
I need to only delete files which are older than 24 hours, not all the files in the directory!!
Hi,
I don't know how to do this directly, but some archive utilities (ARJ for example) can add files to archive which are created before today or before number of days specified. For example, you can move files created before today to some temporary archive and then delete the archive.
Good luck, Igor M
Hi,
Just as a though.
The Problem. Clean files in temp dir older than 24 hours.
Solution: Create a batch file that gets the systems date and creates a dir based on that information.
Example Today is 1-8-1999
In dos the dir will appear 1-8-19~
In explorer it will appear 1-8-1999
Next. After the dir is created all files in the targeted dir (temp) are moved to the dated dir. If you reboot the dir already exist so it will not be recreated. The only effect any files still there are moved to todays dir.
You may then add to the bat an if exist *-1-* rd *-1-* statement. Continueing on up to 30.
Well these thoughts are written on the fly and only intended to be some thoughts for considering.
If you wish to create the program and need some help on the dir/date code just email me.
I am not an expert so any advice by me should be weighed.
All spelling and grammitical errors in the above message are to considered (Copyright of World Library).
LOL LOL LOL
World Library
wlibrary@gdi.net
Original poster says:
Here is a little script. I will assume folder is C:\folder. When you say 'older' than a certain time, I will assume you mean created before that certain time. I will assume that time is 20090522000000 (May 22, 2009, 00:00:00).Quote:
I need help on how to delete files from a particular directory which are older than 24 hours.
Code:# Collect a list of files created before 20090522000000.
var str list ; find -rn "*" "C:\folder" ( 9$ftype=="f") AND ($fctime < "20090522000000") )
# Delete files in list one by one.
while ($list <> "")
do
var str file ; lex "1" $list > $file ; system delete ("\""+$file+"\"")
done
Script is in biterscripting (http://www.biterscripting.com/install.html). Translate it to any batch or scripting langugage of your choice.
Patrick
Patrick, you did check the date on this thread, right. It's ten years old. Please don't resurrect any more older threads. I'm going to leave it open because it could help someone else.......if the script is true to course.