Jump to content

Quick Clean


 Share

Recommended Posts

hello, i wish to write a script that will give me the path of all folders on the current user.

basically, i want to put each path into a variable. (barring a selected few, that i can manually configure into the script)

then i can quickly clean files, using an array or something, and these variables.

lets say i want to erase all text files in every folder but a few and i want to automate deletion.

basically, i would do this.

FileDelete, %variable1%\\*.txt

i dont know how to make an array very well, and i also dont know how to put every path to every folder into a variable, without doing it manually.

help is good, thats why i came! thanks for any help.

examples rule, got any code i can implement? thanks again!

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

This problem gets a lot eaisier if you use version 3 instead of version 2. You can use arrays in 3, as well as some functions to find folders and directories. Some functions you may want to pay particular attention to in the version 3 helpfile:

  • FileFindFirstFile()
  • FileFindNextFile()
  • FileDelete()
  • FileGetAttrib()

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

I'd recommend doing dir /S /B *.txt from the root of all drives. For example, from C:\, type dir /S /B *.txt and you'll get a list of every .txt file on the C: drive (Full path). With AutoIt 3, it would be easy to dump that to a text file, read the text file into an array, then check to make sure the file isn't along one of your paths you don't want to clean, otherwise, delete it. Probably wouldn't take but 15 lines of code or something with AutoIt 3.

Link to comment
Share on other sites

Loop, C:\*.txt, , 1 ; Recurse into subfolders.
{
    MsgBox, 0, Test, %A_LoopFileFullPath%, 1 ; Testing, has to be replaced with: FileDelete, %A_LoopFileFullPath%
}

Well, the code is based on AutoHotkey's Command Reference (which is fortunately backward compatible to AutoIt2 [more...]

It shouldn't be a problem to "convert" it into an AutoIt 3 code (if you prefer to deal with its more complex syntax). :ph34r:

Link to comment
Share on other sites

Is it possible for you to reply to anything without spamming AutoHotKey?

Yes, of course. Macro Scheduler, VBScript, RunCMD, AutoIt 2, DOS, ...

Well, the code is based on AutoHotkey's Command Reference (which is fortunately backward compatible to AutoIt2.

I guess that's a fact.

It shouldn't be a problem to "convert" it into an AutoIt 3 code (if you prefer to deal with its more complex syntax).

IMHO, that's a fact as well. Maybe you can provide that specific AutoIt 3 code equivalent, so t0ddie can make his own mind ???

So you mean I should have hidden that info from t0ddie ?

My interest is to share my knowledge aka support people on solving their issues, no matter if it's done with A, B, or C. As I know A, and partially B I'll recommend those. I leave it to you to recommend C, and to t0ddie and others to decide on their own what's usefull for them - regardless if we're happy with it.

Link to comment
Share on other sites

Well, for me it's a Catch 22. There's the issue of a newbi (assumption: a more sophisticated dev like yourself or Valik, able to deal with a VB-like syntax from scratch, would cruise the AU3 forum in the first place). AutoIt 2 provides a limited command ref.. It's more difficult to solve that issue (maybe a mixed DOS, GoSub, Read, Write workaround) as if to use AHK and of course AutoIt 3!

Hurts the AutoIt3 developers (me) feelings when an AutoIt solution is not provided.

You got it. Confirmed. I've no idea to write AutoIt 3 code, therefore I'm not entitled/able to provide a single line of it. No doubt that you, or Valik or one of the 2186 registered members (08/05/2004 10:22 AM), can do that with a snap of a finger, but you haven't done that in this case. Following Valik's advice not to point to AHK means: Sorry t0ddie, I know how to solve it, but whilst you're not willing to learn AuoIt 3, you're not worth to be supported. That's a fundamentalistic attitude. Hmm, not how I want to be treated nor want to treat others. :ph34r:

In the AutoIt 3 Chat there was a superb statement (sorry wasn't able to find it again) it was all about the same that it's up to the issue which tool makes sense. Fair enough, the soup/fork/spon kinda situation.

If a spoon fundamentalist (Valik) at a spoon forum (A2/A3) advice not to recommend a tea-spoon (AHK) instead of a fork (DOS) to eat the soup (solve the issue) - that's OK with U ? I still leave it with the hungry ones (the newbies) if they want to use a fork(DOS)/tea-spon(AHK)/spoon(A3).

If hungry enough the spoon (A3) will make it, no doubt :(

BTW: IMHO, fundamentalism in any case (software/OS's/religion/politics/...) is narrow minded. You're all doing a tremendous job (as Chris is doing 4 AHK). Let's go ahead to support others. Thx to all of you.

Link to comment
Share on other sites

Why do you insist the syntax is easier for AutoIt2/AHK? When I learned AU2 before I knew any other programming/scripting language, I hated the syntax and thought it was clunky and stupid. Learning C++, Au3, along with bits of Lua, VBS and VBA since then have confirmed, the syntax Au2 used sucks major ass.

AutoHotKey attempts to do what AutoIt does and can be compared 1 to 1 directly with AutoIt. VB (Any), Lua, Kixtart, batch, C, C++, .NET (Any), et all can not be directly compared because they were all created for different reasons.

Personally, I find the reason AHK exists pretty damned pathetic. I'm glad I'm not quite so sensitive as it's author, otherwise, I'd have my own derivation of AutoIt, since not only has Jon either missed, ignored or rejected some of my ideas in the past, he's also rejected some of my implementations of ideas, as well. I'm not running off starting my own branch because of it. If you have thin skin, this is the wrong business to be in (The rhyme was not intentional o.o).

Then, the most annoying part of all is, you're just simply spamming. Whatever it may be, it's still spam. I dislike spam a lot. I blocked ezzetabi's avatar when it was Opera. His posts were like a walking ad for Opera, and to me, having that shoved in my face every time he posted was annoying, so I removed it. He may still have it for all I know. The same goes with your posts. 95% of your posts since AHK was created have have mentioned it. In fact, I can't recall the last time I saw you post in a situation that wouldn't allow you the opportunity to spam AutoHotKey. It's so ridiculous that I wonder if you are on AHK's payroll, and if not, you should be for all the advertising you do. I thought the same thing about ezzetabi and his Opera ads.

Link to comment
Share on other sites

  • Administrators

I _knew_ I should have closed this thread :(

Honest guv, if I ignore or miss anything it's purely due to my job. Currently averaging 60+ hours a week (which sucks as I only get paid for 37 of them). At least I can find the odd minute to post and code though :lol: . I think I only rejected the Process stuff AFAIK but I'm liking how the new version sounds. Your other stuff and code improvments ideas are well cool (I still love the new function lookups). AU3 would be shite without the stuff that you and the other devs do and I'm grateful that you all stick with it.

I do get annoyed by the spam though. AFAIK our users don't log into their forum every day and pick solutions that AU3 could do and spam, and it upsets me that they feel the need to do it to us.

Sick of the topic and closing the thread before more some major :ph34r: starts.

(And yes, even I thought the AU2 syntax was awful at the time - it was done purely because I couldn't work out how to read in a line of code and parse it - happy days :lol: )

Edited by Jon
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...