QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: xra7en on January 02, 2022, 05:27:15 pm

Title: QB quirk on shell dir command?
Post by: xra7en on January 02, 2022, 05:27:15 pm
so working on my emu launcher. and found an interesting quirk (wont call it a bug)

Quote
dir /b /a-d drive:\path\to\folder\ *.bin,*.iso
The above works perfect from the command prompt as intended. Just the bin and iso files show
howeeevvver

Code: QB64: [Select]
  1. ext = "*.bin,*.iso"
  2. rom_path="d:\some big\long\path\to\roms\"
  3. Shell _Hide "dir /b /a-d " + Chr$(34) + ROM_PATH + Chr$(34) + " " + EXT + " > ./romlist.txt"  

gives me ALL the files in the folder. which is what I don't want. Is this a goofy characteristic with QB64?
Title: Re: QB quirk on shell dir command?
Post by: SMcNeill on January 02, 2022, 06:27:14 pm
Backwards slashes in the two examples?  (rom_path is reversed in its direction.)
Also there's no end slash, as per the working example, after roms.
Title: Re: QB quirk on shell dir command?
Post by: xra7en on January 02, 2022, 06:33:18 pm
oops that was a mistake on my post. they are winblows slashes in the cmd they should have been "\" (I edited it to reflect this

UPDATE

I switched drives and did the command again, its a dos error. For some reason, it seems to ignore the switches on different drives.
so this is some weird quirk of dos "dir" from one drive to another. I just doesnt seem to see the /a-d part

Title: Re: QB quirk on shell dir command?
Post by: xra7en on January 02, 2022, 06:43:29 pm
So if I do

c:\> dir /b /a-d "drive:\path\to\roms\snes\" *.iso,*.bin
it says:
the system cannoot find the file specified, and then lists ALL the files in the folder.

However, If I do this in the same drive, no errors, and it lists the two extensions requested.

Unless I forgot how my dos stuff works LOL - VERY possible.

wish list, get dir$ working so it can do this :-)

(or does it)
Title: Re: QB quirk on shell dir command?
Post by: xra7en on January 02, 2022, 10:19:21 pm
OK, solved it this way:

cmd doesn't like the multiple extension in one line.
so used spriggy's split.string  (https://qb64forum.alephc.xyz//index.php?topic=3721.0) to split the extension


then looped through each split and wrote to the text file.

that all worked.

Title: Re: QB quirk on shell dir command?
Post by: bplus on January 03, 2022, 12:01:08 pm
Or get all files and filter out ones you want? Might be faster than all that com with hard disk and OS.