Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
delete old Files with a batch
Name: Krabelke Date: July 2, 2003 at 04:36:08 Pacific OS: NT 4.0 CPU/Ram: Pentium / 128MB
Comment:
Hi,
I have a NT4.0 PC and I want to use a batch file to delete "old" files in a folder. Only those files which are older than two months should be deleted. The files are text files.
To find out the date of creation/last modification of a file I tried something like...: @echo off for %%f in (test.txt) do set LastModDate=%%~tf echo Date of file: %LastModDate%
Name: dtech Date: July 9, 2003 at 06:10:45 Pacific
Reply:
Hi I don't much about NT4, but I wrote a utility program in C, that deletes dates or range of dates. It works in XP Pro ok, I can sent you the source code or the program with the delete part remmed out or it would just show the files that would be deleted to see if it's ok. Doe's NT4 have a Environment variable of the current date. I email the source code or the program or maybe you or I can rewrite it to suit your objective.
0
Response Number 2
Name: Krabelke Date: July 17, 2003 at 02:26:51 Pacific
Reply:
Thank you very much for answer.
I use delen. Its free.
I can specify the date concerned and let it go do its work.
The solution with DELEN is really quick. Just one line like:
Summary: I have tried lots of ways to rename files by using a batch file but I can not add prefixes to the my old file names by using wild cards. Is there a way to rename with wild cards as the samples below. ...
Summary: here is a new solution to delete old files by date -------------------------- example: delete all files that are older than today lsfdt -m lt -d t *.* > c:\temp\filelist.txt delflist c:\temp\filelist....