LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-19-2021, 09:07 AM   #1
Gebby_3
Member
 
Registered: Feb 2021
Location: Beverly, MA
Posts: 57

Rep: Reputation: Disabled
msdos dir cmd vs linux ls


Windows 10 cmd prompt syntax:

dir /b /s d:\!Mp3_A-Z\*.mp3 > d:\!mp3list\filename.lst

What would be the unix equivalent using possibly ls?

I am running a mks unix shell and/or Cgywin

Hoping the unix syntax would run faster.

Finding over 100,000 + lines
 
Old 02-19-2021, 09:14 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,930

Rep: Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320
no, it won't be faster. dir should work better on windows.
The syntax would be something like:
ls <cygwin root dir>/cygdrive_d/\!Mp3_A-Z/*.mp3 > target_file
 
Old 02-19-2021, 09:53 AM   #3
Gebby_3
Member
 
Registered: Feb 2021
Location: Beverly, MA
Posts: 57

Original Poster
Rep: Reputation: Disabled
ls <cygwin root dir>/cygdrive_d/\!Mp3_A-Z/*.mp3 > target_file

Only returns the 8.3 filename format and my dir's also have a "^" in the dirname.
I can easily change the carrot.

The find cmd reacts the same (8.3)

I'm also getting file "*.mp3" not found (There are many subfolders in !Mp3_A-Z)
and are not any in the parent folder !Mp3_A-Z)

Searching my cobwebs from Xenix in the '80's before the company jumped to "Bill Gates"
That was I felt a step backwards but I was only following orders.
 
Old 02-19-2021, 10:00 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,930

Rep: Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320
so ls is not really suitable here. That is not a step backward, but mixing windows and linux which is not a good idea (in general).
 
Old 02-19-2021, 10:14 AM   #5
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,616

Rep: Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554
Quote:
Originally Posted by Gebby_3 View Post
Windows 10 cmd prompt syntax:

dir /b /s d:\!Mp3_A-Z\*.mp3 > d:\!mp3list\filename.lst

What would be the unix equivalent using possibly ls?
As per "dir /?":
Quote:
/B Uses bare format (no heading information or summary).
/S Displays files in specified directory and all subdirectories.
So "/B" is a single filename per line, which is achieved with "-1" for ls.
And "/S" is a recursive listing which is achieved with "-R" for ls.

If you do "ls /path/*.ext" you'll get the path prefixed to filenames.
To avoid that you should do "cd /path/; ls*.txt; cd -" or "pushd /path/; ls*.txt; popd"


As I mentioned in your other thread: ditch MKS Toolkit and just use MinGW (either via MSys2 or Git) then you can use a standard Bash shell & other GNU tools, which makes it easier for anything you write to be cross-platform.

I can confirm neither Git Bash nor MSys Bash will give you 8.3 filenames. (They also allow you to simply write "/d/directory/" and/or drag files into the terminal to have the full path populated).


Last edited by boughtonp; 02-19-2021 at 10:18 AM.
 
  


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
copying files from home dir to another dir from another dir in a lower dir chomito44 Linux - General 5 10-19-2013 06:18 PM
tar dir and sub dir removing files but not existing not empty dir j-me Linux - General 2 08-12-2013 11:37 AM
exclude parameter of rsync- 'dir' vs "dir" vs dir rng Linux - General 5 06-13-2012 01:47 AM
Issue sg_modes cmd at cmd line, want to see the cmd in binary form NuUser Linux - Newbie 1 03-28-2012 08:08 AM
Command to display /dir, /dir/sub, /dir/sub/files knockout_artist Linux - Newbie 9 10-25-2007 02:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:08 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