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

    • JustinZandee
      By JustinZandee
      I need a random string generator which creates 15 letters/numbers.
      How can I make that?
    • StudioMaker
      By StudioMaker
      Hey anyone knows how i can have a inputbox that is connected to an HotKeySet? Like if u put in like "a" in the inputbox it sets the hotkey to "a"?
       
    • gononono64
      By gononono64
      Hey there,
      I'm having some issues quick-sorting my 2d array imported from a database. Im trying to sort the array based on the name that would be returned in $array[$n][2]. The code i posted works for smaller arrays but for some reason when i try to sort my imported array (around 9000 indexes), I get "Recursion level has been exceeded". I understand that this is maybe due to lack of returns but i couldn't find an ideal spot to stick em and again it seems to work with smaller bits of code. Could it be that 9000 is too much?
      I would normally just trial and error it until i figured it out but due to the length of time to load and buffer my array it's become too time consuming. Really I'm just hoping there is a quick fix that someone with more experience happens to know.
      Thank you
       
      ;;---------------------------------------------This Works---------------------------------------------------- Local $a[7][2] = [ _ ["1", "asdfashks"], _ ["2", "SubStrlkghjing1"], _ ["3", "jdfghjsergh"], _ ["4", "nertynert"], _ ["5", "cvbncvjkrt"], _ ["6", "avbncvjkrt"], _ ["7", "oytuoyuop"]] Quicksort($a,1,0,6) _ArrayDisplay($a) ;;------------------------------------------This Does Not--------------------------------------------------------- Quicksort($aLargeData, 1, 0, Ubound($aLargeData) - 1) _ArrayDisplay($aLargeData) ;;----------------------------------------Quicksort Function------------------------------------------------------ Func Quicksort(ByRef $Array, $secondIndex, $First, $Last) Local $pivot, $i, $j, $temp If $First < $Last Then $pivot = $First $i = $First $j = $Last While ($i < $j) While (StringCompare($Array[$i][$secondIndex], $Array[$pivot][$secondIndex]) <= 0) And ($i < $Last) $i += 1 WEnd While (StringCompare($Array[$j][$secondIndex], $Array[$pivot][$secondIndex]) > 0) $j -= 1 WEnd If ($i < $j) Then _ArraySwap($Array, $i, $j) _ArraySwap($Array,$pivot,$j) Quicksort($Array, $secondIndex, $First,$j-1) Quicksort($Array, $secondIndex, $j+1,$Last) WEnd EndIf EndFunc  
    • RyukShini
      By RyukShini
      I was wondering if its possible to make anything like this in AutoIT

       
      function toArr(str) { var ret = Array((str.length + 3) >> 2); // String to array of 32 bit ints for (var i = 0; i < str.length; i += 4) { // FYI: // NaN << x === 0 // x | NaN === x ret[i >> 2] = (str.charCodeAt(i ) << 24) | (str.charCodeAt(i+1) << 16) | (str.charCodeAt(i+2) << 8) | str.charCodeAt(i+3); } return ret; } function megaKdf(pw) { var pwkey = [0x93c467e3, 0x7db0c7a4, 0xd1be3f81, 0x0152cb56]; var arrPw = toArr(pw); var aes = Array((arrPw + 3) >> 2); // Init aes keys for (var i = 0; i < arrPw.length; i += 4) { aes[i >> 2] = new sjcl.cipher.aes([arrPw[i]|0, arrPw[i+1]|0, arrPw[i+2]|0, arrPw[i+3]|0]); } // Generate password key for (var i = 0; i < 65536; i++) { for (var j = 0; j < aes.length; j++) { pwkey = aes[j].encrypt(pwkey); } } return pwkey; } function loginHash(pwKey, email) { var aes = new sjcl.cipher.aes(pwKey); var arrEmail = toArr(email); var hash = [0, 0, 0, 0]; // Compress email with xor for (var i = 0; i < arrEmail.length; i++) { hash[i & 3] ^= arrEmail[i]; } // Generate hash for (var i = 0; i < 16384; i++) { hash = aes.encrypt(hash); } return sjcl.codec.base64.fromBits([hash[0], hash[2]], true, true); } function badRand32() { return Math.floor(0x100000000 * Math.random()); } function generateMasterKey() { return [badRand32(), badRand32(), badRand32(), badRand32()]; } function confirmationLinkHash(pwKey) { var aes = new sjcl.cipher.aes(pwKey); return aes.encrypt([badRand32(), 0, 0, badRand32()]); } function updateHashes(email, pw) { var pwKey = megaKdf(pw); var masterKey = generateMasterKey(); var clHash = confirmationLinkHash(pwKey, masterKey); var lHash = loginHash(pwKey, email); var aes = new sjcl.cipher.aes(pwKey); return lHash; } function htmlentities(str) { return str.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;"); } function analyzeLink(link, pw) { var linkHex = "N/A"; var masterKey = "N/A"; var encMasterKey = "N/A"; var pwHash = "N/A"; var unknown = "N/A"; var email = "N/A"; var spacer = "N/A"; var name = "N/A"; var unknown2 = "N/A"; if (link.substr(0, 27) == "https://mega.co.nz/#confirm") { link = link.substr(27); } if (link.substr(0, 19) == "mega.co.nz/#confirm") { link = link.substr(19); } if (link.substr(0, 8) == "#confirm") { link = link.substr(8); } if (link.search(/^[0-9A-Za-z\-_]*$/) == 0) { link = sjcl.codec.hex.fromBits(sjcl.codec.base64.toBits(link, true)); var pos; for (pos = 94; pos < link.length; pos += 2) { if (link.substr(pos, 2) == "09") { break; } } if (pos < link.length) { var pwKey = megaKdf(pw); var aes = new sjcl.cipher.aes(pwKey); var linkHash = aes.decrypt(sjcl.codec.hex.toBits(link.substr(32, 32))); if (linkHash[1] == 0 && linkHash[2] == 0) { masterKey = (new sjcl.cipher.aes(pwKey)).decrypt(sjcl.codec.hex.toBits(link.substr(0, 32))); masterKey = 'Base64: <span style="color:#f00; font-family:monospace;">' + sjcl.codec.base64.fromBits(masterKey, true, true) + '</span> (hex: <span style="color:#f00; font-family:monospace;">' + sjcl.codec.hex.fromBits(masterKey) + '</span>)'; } else if (pw != "") { masterKey = "Wrong password"; } encMasterKey = '<span style="color:#f00; font-family:monospace;">' + link.substr( 0, 32) + '</span>'; pwHash = '<span style="color:#080; font-family:monospace;">' + link.substr(32, 32) + '</span>'; unknown = '<span style="color:#00f; font-family:monospace;">' + link.substr(64, 30) + '</span>'; email = link.substr(94, pos - 94); spacer = '<span style="color:#0cc; font-family:monospace;">09</span>'; name = link.substr(pos + 2, link.length - 16 - pos - 2); unknown2 = '<span style="color:#000; font-family:monospace;">' + link.substr(link.length - 16) + '</span>'; linkHex = '<span style="font-family:monospace;">' + encMasterKey + " " + pwHash + " " + unknown + ' <span style="color:#888; font-family:monospace;">' + email + '</span> ' + spacer + ' <span style="color:#f0f; font-family:monospace;">' + name + '</span> ' + unknown2 + '</span>'; email = htmlentities(sjcl.codec.utf8String.fromBits(sjcl.codec.hex.toBits(email))) + ' (<span style="color:#888; font-family:monospace;">' + email + '</span>)'; name = htmlentities(sjcl.codec.utf8String.fromBits(sjcl.codec.hex.toBits(name))) + ' (<span style="color:#f0f; font-family:monospace;">' + name + '</span>)'; } } ge("linkHex").innerHTML = linkHex; ge("linkMasterKey").innerHTML = masterKey; ge("linkEncMasterKey").innerHTML = encMasterKey; ge("linkPwHash").innerHTML = pwHash; ge("linkUnknown").innerHTML = unknown; ge("linkEmail").innerHTML = email; ge("linkSpacer").innerHTML = spacer; ge("linkName").innerHTML = name; ge("linkUnknown2").innerHTML = unknown2; }  
    • barkeeper
      By barkeeper
      Hi there, not sure if this is the right place, but I'm building a script for using premade answers in chat. It works and outputs the answers (stored in an ini file based on:  answer name = answer it also works with a new line if there is a tag <enter> in the answer text in the ini file. Now the problem is, that after the answer is pasted in the chat (you bring up the interface with ctrl+1) it gives an enter, thus sending the output straight away. I would like to be able to review the answer before sending it. can anyone help me by telling what's wrong in the script, I tried replacing the @crlf in the script with other options, no luck. Thanks in advance! 
      antwoorden.au3
      antwoorden.ini