mIRC Homepage
Posted By: colt45 Removing directories/files... - 17/09/09 06:55 PM
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
Posted By: DJ_Sol Re: Removing directories/files... - 17/09/09 07:17 PM
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.

Posted By: colt45 Re: Removing directories/files... - 17/09/09 07:22 PM
Yes, but what about subdirectories? smile
Posted By: argv0 Re: Removing directories/files... - 17/09/09 07:35 PM
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
Posted By: Wims Re: Removing directories/files... - 17/09/09 07:43 PM
//noop $findfile(DIR,*,0,0,remove -b $qt($1-)) make it not searching any subdirectory, should not be used here
Posted By: colt45 Re: Removing directories/files... - 17/09/09 10:00 PM
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.
Posted By: colt45 Re: Removing directories/files... - 17/09/09 10:11 PM
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
Posted By: Wims Re: Removing directories/files... - 17/09/09 11:18 PM
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
Posted By: colt45 Re: Removing directories/files... - 17/09/09 11:26 PM
Oh Nice!! - Just how I wanted! laugh

Many thanks! :D:D
© mIRC Discussion Forums