mIRC Home    About    Download    Register    News    Help

Print Thread
#11701 17/02/03 07:32 AM
Joined: Feb 2003
Posts: 79
A
Ancyker Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Feb 2003
Posts: 79
Need a script to find and delete a file type (.xcx) in a certin folder (C:\XCX\Files) but there are other files in the folder that i dont want deleted, im guessing I'd use the $findfile? i think thats it, anyway, I'd like to do it in the fastest manner possible, it has to be done with script though, thanks

#11702 17/02/03 08:11 AM
Joined: Dec 2002
Posts: 1,237
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 1,237
Or you could try another way that is included within windows its called "SEARCH" search for the files that you want to delete and then manually delete them....course thats just a thought LOL

#11703 17/02/03 08:11 AM
Joined: Feb 2003
Posts: 15
H
Pikka bird
Offline
Pikka bird
H
Joined: Feb 2003
Posts: 15
Here ya go, this code should work pretty good!
Code:
alias delxcx {
  window -c @files | window -ln @files 180 60 200 300
  aline -s @files $findfile(C:\XCX\Files,*.xcx,@files)
  %lines = $sline(@files,1).ln | %position = 1
  while (%done != true && %lines > 0) {
    set %line $line(@files,%position)
    remove " $+ %line $+ "
    inc %position
    if (%position >= %lines) { %done = true }
  }
  unset %done %line %lines %position
  window -c @files
}

If there is more than say 1000 of these XCX files, mIRC might appear to hang while it's doing this, just wait it out, if you plan on having to delete a large amount of files often I can add a progress meter to this so you can see that it's doing something.

#11704 17/02/03 08:11 AM
Joined: Dec 2002
Posts: 1,237
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 1,237
Wait never mind i misunderstood....my bad!

#11705 17/02/03 09:04 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Code:

alias delxcx .!echo -q $findfile(C:\XCX\, *.xcx, 0, .remove $+(",$1-,"))


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#11706 17/02/03 12:42 PM
Joined: Jan 2003
Posts: 237
X
Fjord artisan
Offline
Fjord artisan
X
Joined: Jan 2003
Posts: 237
wouldnt: /remove C:/XCX/*.xcx work?



;Check for Life

if (%life == $null) {
goto getlife
}
#11707 17/02/03 01:46 PM
Joined: Feb 2003
Posts: 76
G
Babel fish
Offline
Babel fish
G
Joined: Feb 2003
Posts: 76
Hammer's code is best of all those stated, but if you want to expand it and make a window to tell you what it's deleting try:
Code:
 alias delxcx { 
var %a = 1, %b, %c = $1 
window @Clear
aline @Clear Started *.xcx deleting session in %c !
while ($findfile(%c,*.xcx,%a)) { 
set %b $ifmatch
remove %b
aline @Clear File: %b found and deleted (No: $+ %a $+ )
inc %a } 
if (%a == 1) { 
No .xcx file found in %c } 
} 

The directory is a variable in this case

Last edited by gerdigos; 17/02/03 01:50 PM.

Link Copied to Clipboard