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.
Batch file , need help urgently
Name: elroth Date: February 12, 2008 at 22:32:04 Pacific OS: Windows CPU/Ram: ram 1 GB Product: Dell
Comment:
I need a batch file script which delete a file within D:\NEW\MINE\K based on the modified date.if the modified date is older than 3 months then the file is deleted.
Name: Mechanix2Go Date: February 13, 2008 at 01:36:09 Pacific
Reply:
If you scout around thiis forum you'll see that 'date math' comes up at least a few times a month. It's never a happy ending.
To make any headway, you'll need to giive EXACT OS and date layout.
<font color
0
Response Number 2
Name: elroth Date: February 13, 2008 at 03:13:05 Pacific
Reply:
Well i am quiet new to batch scripting , so i would be really helpful if you can provide a batch file for my requirement. My OS is WINDOWS XP Modified Date Layout : dd/mm/yyyy format like 2/12/2008. This modified date should be compared to the current date , and if it is found to be 3 months older, then it should be deleted.
0
Response Number 3
Name: Mechanix2Go Date: February 13, 2008 at 04:44:58 Pacific
Name: FishMonger Date: February 13, 2008 at 08:58:05 Pacific
Reply:
Why do people always want to use the wrong tool for their required task?
You should use a more appropriate language, such as Perl or Python or VB.
0
Response Number 5
Name: elroth Date: February 13, 2008 at 20:11:31 Pacific
Reply:
Well the format is same that you have provided. i am not quiet acquainted with the other languages like perl. i would like to know, if this can be done using a batch file. if yes could you please provide me one to meet the requirements.
0
Response Number 6
Name: FishMonger Date: February 13, 2008 at 21:35:37 Pacific
Reply:
I'm sure M2 will be able to work up a batch file, but in the mean time, here's an example Perl script.
#!perl
use strict; use warnings; use constant DAYS => 90;
foreach my $file ( <D:/NEW/MINE/K/*> ) { if ( -M $file > DAYS ) { print "Deleting $file\n"; unlink $file or warn "failed to delete $file $!\n"; } }
The definition/calculation of a month could vary a bit since a month varies between 28 - 31 days. I chose to use 90 days to equal 3 months
0
Response Number 7
Name: elroth Date: February 14, 2008 at 04:22:01 Pacific
Reply:
thanx fishmonger for the perl code, but actually i require a batch file script,if any one of u can provide me one.
0
Response Number 8
Name: elroth Date: February 15, 2008 at 02:30:29 Pacific
Reply:
sorry guys , i am not being able to work with that perl script. batch file , i can work on. i would be happy , if you can meet my requirement
Summary: Hi All, I am new in writing windows batch file. I am facing a problem and not able to solve it, so please help me out. My problem is --- I need to rename all files of the form *.mp4.ts in an input fol...
Summary: Hi M2, One more small query.. I need bacth file command for check the list of URL's. Like I have some list of URL's to check daily if they are up or not..So Can I check it using Batch file?? Please h...
Summary: I am trying to kill IE using batch file , need help ...below command not working START "C:\Program Files\Internet Explorer\iexplore.exe" www.yahoo.com taskkill /im "iexplore.exe" goto START ...