Quote from PaulJonestindall on April 13, 2021, 4:36 pmThe reason you can't use RemoveFolder is you probably still have files in it. RemoveFolder only works on empty folders.
If you know exactly what files are there then you need to FileErase each one and then remove the folder.
If you don't know the file names or how many there are you could do something like this:FileList "[TempDir]Test_Folder" "Files" "[tempfilelist]"
FileWrite "[TempDir]tempfilelist.txt" "All" "[tempfilelist]"
FileLen "[TempDir]tempfilelist.txt" "[tempfilelistlen]"
Loop "1" "[tempfilelistlen]" "[filelistloop]"
FileRead "[TempDir]tempfilelist.txt" "[filelistloop]" "[filename]"
FileErase "[filename]"
EndLoop
RemoveFolder "[TempDir]Test_Folder"
The reason you can't use RemoveFolder is you probably still have files in it. RemoveFolder only works on empty folders.
If you know exactly what files are there then you need to FileErase each one and then remove the folder.
If you don't know the file names or how many there are you could do something like this:
FileList "[TempDir]Test_Folder" "Files" "[tempfilelist]"
FileWrite "[TempDir]tempfilelist.txt" "All" "[tempfilelist]"
FileLen "[TempDir]tempfilelist.txt" "[tempfilelistlen]"
Loop "1" "[tempfilelistlen]" "[filelistloop]"
FileRead "[TempDir]tempfilelist.txt" "[filelistloop]" "[filename]"
FileErase "[filename]"
EndLoop
RemoveFolder "[TempDir]Test_Folder"
Quote from saeid on April 13, 2021, 6:12 pm@jncon
Thanks for your help.
The problem of your idea is that rmdir removes only an empty directory.
Thanks for your help.
The problem of your idea is that rmdir removes only an empty directory.
Quote from saeid on April 13, 2021, 6:19 pm@pauljonestindall
Thanks for suggesting idea.
The only problem of your suggestion is that "FileList" generates a list of files in one line (the names of the files are continuous not in separated line). So, we can't use "FileLen" to calculate the numbers of the files.
What's your idea to solve this problem?
Thanks for suggesting idea.
The only problem of your suggestion is that "FileList" generates a list of files in one line (the names of the files are continuous not in separated line). So, we can't use "FileLen" to calculate the numbers of the files.
What's your idea to solve this problem?
Quote from Gaev on April 13, 2021, 7:22 pm@saeid
The problem of your idea is that rmdir removes only an empty directory
Please read this page ... https://www.computerhope.com/rmdirhlp.htm ... on how to get around this issue.
The only problem of your suggestion is that "FileList" generates a list of files in one line (the names of the files are continuous not in separated line). So, we can't use "FileLen" to calculate the numbers of the files.
On this Help page for VisualNEOWin ... https://winhelp.visualneo.com/Files1.html ... in the section for FileList command, it says ...
Multiple files will be separated by carriage returns ([#13])
... so you can split this content into arrayed variables and loop through them.
The problem of your idea is that rmdir removes only an empty directory
Please read this page ... https://www.computerhope.com/rmdirhlp.htm ... on how to get around this issue.
The only problem of your suggestion is that "FileList" generates a list of files in one line (the names of the files are continuous not in separated line). So, we can't use "FileLen" to calculate the numbers of the files.
On this Help page for VisualNEOWin ... https://winhelp.visualneo.com/Files1.html ... in the section for FileList command, it says ...
Multiple files will be separated by carriage returns ([#13])
... so you can split this content into arrayed variables and loop through them.

Quote from HPW on April 13, 2021, 7:25 pmHello,
Filelist does not generates a list in one line. It makes a list with CR seperated lines.
You could parse this into an array and loop through it.
FileList "C:\Temp\*.jpg" "Files" "[flist]"
StrParse "[flist]" "[#13]" "[filist]" "[filistcount]"Regards
Ps:Oops Gaev was faster! ;-)
Hello,
Filelist does not generates a list in one line. It makes a list with CR seperated lines.
You could parse this into an array and loop through it.
FileList "C:\Temp\*.jpg" "Files" "[flist]"
StrParse "[flist]" "[#13]" "[filist]" "[filistcount]"
Regards
Ps:Oops Gaev was faster! ;-)
Quote from JnCon on April 13, 2021, 8:18 pmThis method has been tested and working:
create the cmd file with neobook automatically when open your app (startup event):
FileWrite "[PubDir]remove.cmd" "1" "waitfor /T 2 pause" FileWrite "[PubDir]remove.cmd" "2" "rmdir /Q /S [TempDir]Test_folder"run cmd file with Shutdown event:
Run "[PubDir]remove.cmd" "" "Hidden" "" ""It will remove the "Test_folder" directory and it's files and subdirectories 2 s after app closed.
This method has been tested and working:
create the cmd file with neobook automatically when open your app (startup event):
FileWrite "[PubDir]remove.cmd" "1" "waitfor /T 2 pause" FileWrite "[PubDir]remove.cmd" "2" "rmdir /Q /S [TempDir]Test_folder"
run cmd file with Shutdown event:
Run "[PubDir]remove.cmd" "" "Hidden" "" ""
It will remove the "Test_folder" directory and it's files and subdirectories 2 s after app closed.
Quote from PaulJonestindall on April 15, 2021, 3:57 pmYes, StrParseing the FileList variable would be a faster executing code.
Yes, StrParseing the FileList variable would be a faster executing code.