Old 30th March 2011, 15:44   #1
NSISNUB
Junior Member
 
Join Date: Aug 2010
Posts: 44
Recursive Delete

Hi,

I have a file system C:\Folder1\Folder2\Folder3\Folder4\Folder5

Folder4 can be a wildcard folder, and under every Folder4 contains a single folder which I want to delete.

Is there a slick way to do this?
NSISNUB is offline   Reply With Quote
Old 30th March 2011, 15:56   #2
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 462
yes.

Check FindFirst/FindNext.

Inside a loop that will give you the "Folder4" names, you will delete the Folder5 like this:
RMDir "C:\Folder1\Folder2\Folder3\$1\Folder5"
demiller9 is offline   Reply With Quote
Old 30th March 2011, 16:31   #3
NSISNUB
Junior Member
 
Join Date: Aug 2010
Posts: 44
Doesn't find first find file names and not folder listing?
NSISNUB is offline   Reply With Quote
Old 30th March 2011, 16:33   #4
NSISNUB
Junior Member
 
Join Date: Aug 2010
Posts: 44
nevermind it does, thanks!
NSISNUB is offline   Reply With Quote
Old 30th March 2011, 16:42   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Note it will also return . and .. which you should exclude.

Stu
Afrow UK is offline   Reply With Quote
Old 30th March 2011, 16:44   #6
NSISNUB
Junior Member
 
Join Date: Aug 2010
Posts: 44
..
NSISNUB is offline   Reply With Quote
Old 30th March 2011, 16:57   #7
NSISNUB
Junior Member
 
Join Date: Aug 2010
Posts: 44
Just tested this using *.* it picks up both directories and files, I want just directories.
NSISNUB is offline   Reply With Quote
Old 30th March 2011, 17:03   #8
NSISNUB
Junior Member
 
Join Date: Aug 2010
Posts: 44
..
NSISNUB is offline   Reply With Quote
Old 30th March 2011, 17:43   #9
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
It will return both. To filter out directories check if the current file is a directory using IfFileExists path\$1\*.*

Stu
Afrow UK is offline   Reply With Quote
Old 30th March 2011, 17:48   #10
NSISNUB
Junior Member
 
Join Date: Aug 2010
Posts: 44
I want only directories:

${If} ${FileExists} "C:\d1\d2\d3\TEST\Data\*.*"
FindFirst $2 $3 "C:\d1\d2\d3\TEST\Data\*.*" #First thing find all directories
loop:
StrCmp $3 "" done
${IfNot} "." == $3
${AndIfNot} ".." == $3

#RM the directory

${EndIf}
FindNext $2 $3
Goto loop
done:
FindClose $2
${Endif}

Where does it need to go? I thought I was already handling this.
NSISNUB is offline   Reply With Quote
Old 30th March 2011, 18:01   #11
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
See my post: http://forums.winamp.com/showthread.php?t=329007

Stu
Afrow UK is offline   Reply With Quote
Old 30th March 2011, 18:14   #12
NSISNUB
Junior Member
 
Join Date: Aug 2010
Posts: 44
Thanks! got it.
NSISNUB is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump