Sign in to follow this  
Followers 0
forever0donotknowme

old files

26 posts in this topic

hi my friends,

really this is important topic

i have some folder that contain many files with different extentions

i want to do script that delete every files that are used befor one month = old and not open now

for example, prefetch folder

yes, in this case i will use file list array

filedelete

but i do not crrect script for my project that is used for deleting old prefetch files

Share this post


Link to post
Share on other sites



Usse FileGetTime on each file and compare the date returned (last modified or last accessed date) with the current date and see if they're more than a month apart.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

BrewManNH ;)

my sir ,Do you think my intelligence and my experience and got to your level of practical

i will try to make this hard script

Share this post


Link to post
Share on other sites

Do what BrewManNH said and utilize _DateDiff()


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

You'd have to reformat the values returned from the FileGetTime function to work with _DateDiff, but shouldn't be hard to do that. I'd also use _NowCalcDate instead of using _Now if using _DateDiff, because it returns the date in the format needed for _DateDiff.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

i will try today to write this script

it will be ready tomorrow

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

#include <Array.au3>
#include <FileOperations.au3>

Global $TimeDiff = 3600 * 24 * 30
$TimeCurrent = _NowCalc()

$FileList = _FO_FileSearch(@WindowsDir, '*.tmp|*.log')
; $FileList = _FO_FileSearch(@WindowsDir, '*.tmp')
_ArrayDisplay($FileList, 'File = *.tmp|*.log')

$c = 0
For $i = 1 To $FileList[0]
    $t = FileGetTime($FileList[$i], 1)
    $sTime = $t[0] & '/' & $t[1] & '/' & $t[2] & ' ' & $t[3] & ':' & $t[4] & ':' & $t[5]
    If _DateDiff('s', $sTime, $TimeCurrent) > $TimeDiff Then
        $c += 1
        $FileList[$c] = $FileList[$i]
    EndIf
Next
ReDim $FileList[$c + 1]
$FileList[0] = $c
_ArrayDisplay($FileList, '>month')

If MsgBox(4, '???', 'FileDelete ?') = 6 Then
    $err = ''
    For $i = 1 To $FileList[0]
        If Not FileDelete($FileList[$i]) Then
            If Not (FileSetAttrib($FileList[$i], '-RST') And FileDelete($FileList[$i])) Then
                $err &= $FileList[$i] & @CRLF
            EndIf
        EndIf
    Next
    If $err Then MsgBox(0, 'Error', $err)
EndIf
Edited by AZJIO

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

#include <FileOperations.au3>

error: error opening file

can you practice that script in prefetch folder for deleting all old files that not edited since last 20 days

Edited by forever0donotknowme

Share this post


Link to post
Share on other sites

#include <FileOperations.au3>

error: error opening file

(again)

last 20 days

Global $TimeDiff = 3600 * 24 * 20

Share this post


Link to post
Share on other sites

can you help me and give me full script for prefetch folder

Share this post


Link to post
Share on other sites

forever0donotknowme, you've been around long enough to know better than to expect people to write your script for you. Put some effort into it, write something out based on the excellent suggestions you have received thus far, and then post your code if you run into problems.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

forever0donotknowme, you've been around long enough to know better than to expect people to write your script for you. Put some effort into it, write something out based on the excellent suggestions you have received thus far, and then post your code if you run into problems.

you know my experience

Share this post


Link to post
Share on other sites

you know my experience

Oh yeah... all talk, no action.

i will try today to write this script

it will be ready tomorrow


Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Oh yeah... all talk, no action.

;) i write some script but AZJIO guide me to another method

my teachers are BrewManNH, albma23 , jlogan

Edited by forever0donotknowme

Share this post


Link to post
Share on other sites

AZJIO code

i can not solve my problem in this topic

please can any one help me to give me script to delete old files that created more than one month in some folder that is existing in desktop

Share this post


Link to post
Share on other sites

I don't think anyone wants to proverbially "give the gun to the chimp" and watch you shoot yourself and or others. Write the script a little at a time, until you got an understanding of how it works. You will continue to try to butter up others and hope they write it for you, but if someone gives you the script you learn nothing.

Plan out the script before writing it.

Read the help file, explore it and see what closely fits into your plans.

Writing a script with no thought does you a disservice and causes only problems.


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

if you give me ready code, i will learn benefit for every line of code

Share this post


Link to post
Share on other sites

i want script without message for delete attention<<< automatically delete all files that were created befor one month in prefetch folder

Share this post


Link to post
Share on other sites

I believe the continued begging for "ready code" violates the spirit of the forum rules, especially the part about not being a "general nuisance" :)

You know by now that we teach people to fish, rather than handing it to them, forever0donotknowme. You have to put some effort into it and post your own code, even if it doesn't work. Then, we will gladly assist you.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0

  • Similar Content

    • WiorDi37
      By WiorDi37
      Hello, Everyone!
      I want when clicking the exit button the window will close. If content changes upon exit the program will automatically choose not save.
      Look forward to the help, thanks.
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> $GUI = GUICreate("Form1", 220, 119, 192, 124, $WS_SYSMENU) GUISetFont(10, 400, 0, "Tahoma") GUICtrlCreateGroup("Chuẩn bị trình chiếu", 16, 16, 185, 65) $ok_Button = GUICtrlCreateButton("Ok", 32, 48, 75, 25) $exit_Button = GUICtrlCreateButton("Exit", 112, 48, 75, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $ok_Button ShellExecute(@MyDocumentsDir&'\Dich-thuat\Short-Document.pdf', "", "", Default, @SW_MAXIMIZE) WinWaitActive("Data and Computer Communications (Eighth Edition) - Google Chrome") ShellExecute(@MyDocumentsDir&'\Dich-thuat\Document.rtf', "", "", Default, @SW_MAXIMIZE) WinWaitActive("Document.rtf [Compatibility Mode] - Word") ShellExecute(@MyDocumentsDir&'\Dich-thuat\Presentation1.pptx', "", "", Default, @SW_MAXIMIZE) WinWaitActive("Presentation1.pptx - PowerPoint") MouseClick("left", 1381, 886, 1) Sleep(2000) MsgBox(64, "Thông báo", "Đã chuẩn bị xong") Case $exit_Button WinClose("Presentation1.pptx - PowerPoint") ;I need help handling this place Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd  

    • badcoder123
      By badcoder123
      Hey everyone,
      I've been messing around with some new things and adlibs look extremely useful/interesting, however, I can't seem to get it to work.. Here's what I have
      HotKeySet("{F1}", "_Exit") $qCount = 1 Global $_Timer AdlibRegister($_Timer, 1000) AdlibUnRegister($_Timer) While 1 SoundPlay(@WindowsDir & "\media\tada.wav", 1) $qCount += 1 ToolTip('"Tada" has been played ' & $qCount & " times",200,200) WEnd Func _Timer() Local Static $iCount += 1 ConsoleWrite($iCount) If $iCount = 20 Then ConsoleWrite("iCount is at " & $iCount) EndFunc Func _Exit() Exit EndFunc Basically I want it to call the _Timer function but it doesn't seem to work :/ any ideas?
    • DagSa
      By DagSa
      Try to find a solution for help files to my autoit executable.
      Its installed from simple XP-POS cash computers to desktop with windows 7, 8, 10.
      The compiled AutoIt program itself work everywhere, but the help file??
      I need a help file called from from the program and I don't really know what working best in all OS platforms.
      1. A wordfile is helpful enough, but word is not installed everywhere.
      2. RTF is very big files with pictures.
      3. I could save it as pdf, but not all have it either.
      4. Tried  .MHT file, but downside is browser could cover hole screen if browser closed this way. I have not found any way to resize it to specific size when open up.
      5. Use of IE.au3 lib. Well it could open mht files ,but always got question about use it as default browser or not. Think this also make IE browser lose control so I could not resize.
      6. Look at making a  .CHM file, but I don't think its the future do use that format. (.hlp is no no and old)

      Any tips of do it in autoit or make a call to open up in some nice format working everywhere.
       
    • au3leecher
      By au3leecher
      Hellow everybody,
      I tryed to manipulate a game called "Assault Cube" which is a easy beginning in coding. I run the code but the wished value doesn't change, i don't understand why.
      The Pointers are fine, I checked that the pointers don't change every time while restart the game.
      My Code:
      <snip>
      _____________________________________________________________________________________________________________________________________________________________________________________________
      Checklist:
      The Offsets are 18C & 4
      In Cheat Engine: ("ac_client.exe"+0010F418) <- Pointer
      4 Bytes = 'dword'
       
    • geekyworld
      By geekyworld
      Hi. I want to read the help file on my Kindle ebook reader (to protect my eyes). Is it available in Kindle or epub format? I tried converting it myself but the results were not very good.
      --Thanks!