Directory Create Utility - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Utilities (https://qb64phoenix.com/forum/forumdisplay.php?fid=8) +---- Thread: Directory Create Utility (/showthread.php?tid=895) |
Directory Create Utility - eoredson - 09-16-2022 Hi, Instead of a directory delete utility like Silent, why not build a directory create utility. Attached is a directory create utility. The difference between MKdir and MD is that MD creates a directory and Makedir.bas makes an entire path.. For example, you could create \temp\newdir\nextdir\ Erik. RE: Directory Create Utility - SpriggsySpriggs - 09-16-2022 It threw me off when I was reading your code with all those dots in the variable names. I thought you left off some TYPE definition at first. Cool code. RE: Directory Create Utility - Pete - 09-16-2022 I like using dots but mostly just when I use TYPEs, for the same reason. So if I had LINE INPUT "Make what Dir/Path: " And input "myfolder\folder1\pete" I would get a$ = "myfolder\folder1\pete" Parse it out with INSTR() myfolder folder1 pete Check for IF _DIREXISTS for each parsed dir name. Make the directory if it does not exists. Follow the parsing down the path to completion. That's handy. Does it also get into making multiple sub-directories like: myfolder/folder1, myfolder/folder2, etc.? I used to use a FOR/NEXT loop to assign sub-folders numbers with a MKDIR loop for that. Pete RE: Directory Create Utility - SpriggsySpriggs - 09-16-2022 And for me, unless I was needing to really create these directories all the time I'd just use PowerShell to do it once. You're probably not going to be making directories that often where the speed will be something critical. Usually, I make a program that checks for something existing and if it doesn't, it makes it. And if I was only needing it for that first launch, I'd just use PowerShell. Less code needed and you can still find out if it succeeded or not. RE: Directory Create Utility - eoredson - 09-17-2022 (09-16-2022, 03:18 PM)Pete Wrote: I like using dots but mostly just when I use TYPEs, for the same reason. @pete: Yes! I could easily add multiple paths on input. For example: \temp1, \temp2, ... and in quotes: "\dir1\", "\dir2\", ... in the attached file... also adds GetLastError DisplayWinErrr. RE: Directory Create Utility - Pete - 09-17-2022 Nice! Pete RE: Directory Create Utility - Kernelpanic - 09-17-2022 This is probably easier to do with VBScript (Windows Scripting Host). The program example should show that you can also delete under Windows without asking. I have now changed it so that a folder is created via the query, which is then automatically after 5 seconds deleted again. That could certainly be easily converted to create any folder. In the end it's more of a gimmick. But one can learn from it. In my example, the folder "Beispiel" is created in H:\Ablage\Beispiel. Adapt it to your own system when trying it out. Name: XYZ.vbs Code: (Select All) 'Windows Scripting Host Beispiel, 15. April 2019/14. Sept. 2022 |