mIRC Home    About    Download    Register    News    Help

Print Thread
Removing directories/files... #215445 17/09/09 06:55 PM
Joined: Nov 2003
Posts: 71
C
colt45 Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Nov 2003
Posts: 71
Quote:
/rmdir <dirname>
Deletes the specified directory.
Note: If the directory contains files, it cannot be deleted.


That's fair enough but is there's another way round to it? - Because I'm trying to delete files and subdirectories rather than doing them manually everytime.

Hope a suggestion or code... thx
Colt

Re: Removing directories/files... [Re: colt45] #215446 17/09/09 07:17 PM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Use $findfile to count the files in the directory.

Then a loop to /remove them.

/remove [-b] <filename>
Deletes the specified file.
The -b switch deletes the file and moves it to the recycle bin.


Re: Removing directories/files... [Re: DJ_Sol] #215447 17/09/09 07:22 PM
Joined: Nov 2003
Posts: 71
C
colt45 Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Nov 2003
Posts: 71
Yes, but what about subdirectories? smile

Re: Removing directories/files... [Re: colt45] #215448 17/09/09 07:35 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
There's probably a better way to do what you're trying to do, although you haven't bothered to explain what it is you're trying to do.

//noop $findfile(DIR,*,0,remove -b $qt($1-)) works fine for me.

edit: correction

Last edited by argv0; 17/09/09 09:16 PM.

- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: Removing directories/files... [Re: argv0] #215449 17/09/09 07:43 PM
Joined: Jul 2006
Posts: 3,558
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,558
//noop $findfile(DIR,*,0,0,remove -b $qt($1-)) make it not searching any subdirectory, should not be used here

Last edited by Wims; 17/09/09 07:44 PM.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Removing directories/files... [Re: argv0] #215450 17/09/09 10:00 PM
Joined: Nov 2003
Posts: 71
C
colt45 Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Nov 2003
Posts: 71
Originally Posted By: argv0
There's probably a better way to do what you're trying to do, although you haven't bothered to explain what it is you're trying to do.

//noop $findfile(DIR,*,0,remove -b $qt($1-)) works fine for me.

edit: correction


I did say files and subdirectories but thanks - will try that now.

Re: Removing directories/files... [Re: colt45] #215451 17/09/09 10:11 PM
Joined: Nov 2003
Posts: 71
C
colt45 Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Nov 2003
Posts: 71
Ok, appears to work only on FILES including all the files from subdirectories.

But the folder still there frown

i.e.

c:\TEST\
c:\TEST\FOLDER1
c:\TEST\FOLDER1\test.txt
c:\TEST\FOLDER1\test2.txt
c:\TEST\FOLDER2
c:\TEST\FOLDER2\test1.txt
c:\TEST\FOLDER2\test2.txt
c:\TEST\FOLDER3
c:\TEST\FOLDER3\test1.txt
c:\TEST\FOLDER3\test2.txt

Want to script something that completely remove C:\TEST folder along with the rest of subdirectories and files.

Thx

Last edited by colt45; 17/09/09 10:12 PM.
Re: Removing directories/files... [Re: colt45] #215452 17/09/09 11:18 PM
Joined: Jul 2006
Posts: 3,558
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,558
Code:
alias _rmdir .comopen a Scripting.FileSystemObject | .comclose a $com(a,DeleteFolder,1,string,$1-)
/_rmdir path, do not use quote even if the path has spaces


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Removing directories/files... [Re: Wims] #215453 17/09/09 11:26 PM
Joined: Nov 2003
Posts: 71
C
colt45 Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Nov 2003
Posts: 71
Oh Nice!! - Just how I wanted! laugh

Many thanks! :D:D