Author Topic: QB quirk on shell dir command?  (Read 3629 times)

0 Members and 1 Guest are viewing this topic.

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
QB quirk on shell dir command?
« 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?
« Last Edit: January 02, 2022, 06:38:16 pm by xra7en »
I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: QB quirk on shell dir command?
« Reply #1 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.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: QB quirk on shell dir command?
« Reply #2 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

I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: QB quirk on shell dir command?
« Reply #3 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)
I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline xra7en

  • Seasoned Forum Regular
  • Posts: 284
    • View Profile
Re: QB quirk on shell dir command?
« Reply #4 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 to split the extension


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

that all worked.

I just like re-writing old DOS book games into modern QB64 code - weird hobby, I know!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: QB quirk on shell dir command?
« Reply #5 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.