LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-23-2018, 02:22 PM   #16
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930

Forgetting the language difficulties of batch for Windows and what syntax it has now, there's a functional requirement which isn't too easy here, or too clearly written, or shall we say reasonably written.

You wish to find all files that are of a certain type and then randomize the selection of them.

OK, maybe not so bad, and maybe something which can be done in memory versus the brute force I'd use, a file.

I.e. if I had to find all MP3 files, I'd do a find command for that extension. I'd save that into a file. And then I'd figure out how to either randomize the lines of that file, or randomize my picking of any one given line from that file. I suppose I'd do the second option.

Sorry I'd have to work a bit to determine for myself how to do that in bash or C. I'm no longer versed in batch language. (Since autoexec.bat went away)

A more important point though is that you need to clarify your pseudocode and select the tasks which you are going to perform to accomplish this.

Or at least you need to understand that somehow you have to find a list of all files and where they are.

I seriously doubt in any system Linux or Windows that you say some element of the directory tree structure can be treated as "random". I think you have to find all that can be found, or a bunch of them, and then find a way to randomize the final selection from that list.
 
Old 04-24-2018, 08:19 PM   #17
trainspotting
LQ Newbie
 
Registered: Apr 2018
Distribution: Ubuntu, Mint
Posts: 8

Original Poster
Rep: Reputation: Disabled
Sorry for the late reply

Don't think collage is something I could do ATM - It would be helpful to have others & someone to annoy.
you're right though computers are a very strange and addicting place to explore (electric traffic)

Ok so I'll keep learning DOS (most PC's i fix are Windows) continue messing around with linux distros and move to something like Python. Whould Python be a good all rounder ?
Heard alot of people talk about Python & Perl. Will leave that as a last question otherwise You'll be here all day (many many questions)

"I seriously doubt in any system Linux or Windows that you say some element of the directory tree structure can be treated as "random". I think you have to find all that can be found, or a bunch of them, and then find a way to randomize the final selection from that list"

sorry didn't see the 2ed page till now.

Think I need to sit, chill and tinker. Was just a thought of how to get past unknown variables (network cards, random file names)
From what you guys are saying sounds like computers only work with absolutes or it takes time to bodge something together ?

Anyway thank you for putting up with the clueless\newbie questions guys

Last edited by trainspotting; 04-25-2018 at 03:01 AM.
 
Old 04-25-2018, 03:18 AM   #18
bodqhrohro
Member
 
Registered: Apr 2018
Location: Ukraine
Distribution: Debian GNU/Linux 12
Posts: 62

Rep: Reputation: Disabled
Quote:
Originally Posted by dugan View Post
I thought BASH was the standard scripting environment for Windows now?
It isn't. Windows Subsystem for Linux is a separate world that doesn't come out of box and has too many limitations. Older third-party stuff such as Cygwin and MSYS2 has same problems. BASH is too tied to UNIX-like systems.

Advanced scripting on Windows is done via PowerShell for years, or via third-party stuff such as AutoHotkey; before PowerShell there was active usage of VBScript/JScript. However, BAT/CMD still remains widely used for simple tasks as PowerShell is a bit heavyweight and complicated.
 
2 members found this post helpful.
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DOS Batch question (yes i know...) watcher69b General 1 03-17-2009 11:14 AM
xp batch script question babag Programming 8 01-31-2007 02:52 PM
Batch rename question hellblade Linux - Software 4 05-03-2004 03:57 PM
Batch Question hornet74 Linux - General 2 02-02-2004 04:39 PM
Linux Backup Batch question lowly_tech Linux - Newbie 2 01-09-2002 04:02 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration