Guest nate020605 Posted January 16, 2007 Share Posted January 16, 2007 I'm curious if there is a way to search a network directory such as a shardedrive and delete old files by date last accessed. i havnt found anything in AutoIt that would check the date last accessed, Simply put I need Advice on how to. 1. Write a script that will Search a Drive 2. Find out the date last accessed of all files 3. delete them if they exceed the specified length of time. Thanks for all the help in advance Link to comment Share on other sites More sharing options...
xcal Posted January 16, 2007 Share Posted January 16, 2007 1. FileFindFirstFile and FileFindNextFile. 2. FileGetTime (option 2). 3. If file time > exceeded time then FileDelete. You'll also want to check out Loop Statements. How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
Developers Jos Posted January 16, 2007 Developers Share Posted January 16, 2007 http://www.autoitscript.com/forum/index.ph...ost&p=30391 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
xcal Posted January 16, 2007 Share Posted January 16, 2007 Or you could use an existing UDF. How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
daashag Posted January 16, 2007 Share Posted January 16, 2007 http://www.autoitscript.com/forum/index.ph...ost&p=30391Please excuse my newbiness but is the above link the udf. Link to comment Share on other sites More sharing options...
herewasplato Posted January 16, 2007 Share Posted January 16, 2007 Please excuse my newbiness but is the above link the udf.YesSee the part that starts with the line:Func _Remove_Files($T_Dir,$T_Incl_SubDir,$T_Days) [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
daashag Posted January 16, 2007 Share Posted January 16, 2007 Thanks herewasplato for the reply. I still don't understand the usage of this script. Can I call the the udf and pass arguments to it like path and age, if so what is the syntax for that, or do I need to edit the script and hardcode the age and path of files I want to delete? Link to comment Share on other sites More sharing options...
Developers Jos Posted January 16, 2007 Developers Share Posted January 16, 2007 (edited) Thanks herewasplato for the reply.I still don't understand the usage of this script. Can I call the the udf and pass arguments to it like path and age, if so what is the syntax for that, or do I need to edit the script and hardcode the age and path of files I want to delete?Please do not run this script if you dont understand what it does..It was intended to get you a head start.Deleting files is never a trivial thing to just grab somebodies script and "Try" it ... Edited January 17, 2007 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
daashag Posted January 16, 2007 Share Posted January 16, 2007 Please do not run this script if you dont understand what it does..It was intended to get you a head start.Deleting files in never a trivial thing to just grab somebodies script and "Try" it ...I appreciate your concern. however it doesn't help me a whole lot. I was doing some research on udfs, and from what I understood they are code snippets that you can use in scripts by just including the .au3. So if I saved your script as delfiles.au3 and included it in another script, I could just call the function remove files and pass it parameters. Is that correct? Link to comment Share on other sites More sharing options...
Developers Jos Posted January 16, 2007 Developers Share Posted January 16, 2007 I appreciate your concern. however it doesn't help me a whole lot. I was doing some research on udfs, and from what I understood they are code snippets that you can use in scripts by just including the .au3. So if I saved your script as delfiles.au3 and included it in another script, I could just call the function remove files and pass it parameters. Is that correct?That is correct ... all I am saying is make sure you comment the filedelete() portion while testing ...The UDF makes a logfile where you can check what it would have done .. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
herewasplato Posted January 17, 2007 Share Posted January 17, 2007 Thanks herewasplato for the reply.I still don't understand the usage of this script...Neither do I :-)I would have to study each line - but I have no need for this UDF at this time - so... that task will fall to you...and like JdeB said, you can "include" the file using the include file.(or just copy/paste it to the bottom of your main script)...enjoy... [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
daashag Posted January 17, 2007 Share Posted January 17, 2007 Thanks guys appreciate your help. The script works beautifully. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now