Please register or login. There are 0 registered and 917 anonymous users currently online. Current bandwidth usage: 326.30 kbit/s November 30 - 12:48pm EST 
Hardware Analysis
      
Forums Product Prices
  Contents 
 
 

  Latest Topics 
 

More >>
 

    
 
 

  You Are Here: 
 
/ Forums / General Technology /
 

  MSDOS Switch to suppress path 
 
 Author 
 Date Written 
 Tools 
binar Jan 24, 2014, 09:47pm EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List Replies: 7 - Views: 3857
Fellow Forum Members,

Using the MSDOS command below:

C:\Root>dir /b /s | more

Produces the list below on my monitor screen:
C:\Root>file1.doc
C:\Root>file2.doc
C:\Root>file3.doc
C:\Root>file4.doc

The problem is I don't want the "C:\Root" text to appear. I only want the "file#.doc" text to appear on my monitor screen. What switch do I need to use (besides /b & /s) to prevent the "C:\Root" text from appearing. In short, my goal is to only generate a list that creates a filename list without any path information included. Any info will be appreciated.




Want to enjoy fewer advertisements and more features? Click here to become a Hardware Analysis registered user.
john albrich Jan 24, 2014, 10:08pm EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List

Edited: Jan 24, 2014, 10:34pm EST

 
>> Re: MSDOS Switch to suppress path

john albrich Jan 25, 2014, 12:45am EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Non-batch/Non-CommandLine GUI-based Possible Alternatives
.
I know you spec'd a Command Line implementation, but just in case...if you can use, or don't mind using Windows GUI programs, here are some possible alternatives that may provide the equivalent functionality as well. At the very least, XYplorer has made my day-to-day life much easier. *


XYplorer
XYplorerFree 13.70.0100, released 24-Jan-2014
http://www.xyplorer.com/index.php
http://www.xyplorer.com/features.php
http://www.xyplorer.com/free.php (free version download)
XYplorer is a tabbed file manager for Windows. It features a powerful file search, a versatile preview, a highly customizable interface, optional dual pane, and a large array of unique ways to efficiently automate frequently recurring tasks. It's fast and light, it's innovative, and it's portable.


I don't know for sure that the following programs will still do what you're looking for, but they may do so. I'm pretty sure they used to do so.

Q-Dir
http://www.majorgeeks.com/files/details/q_dir_portable.html
http://www.softwareok.com/
Q-Dir Portable 5.92
Author: Nenad Hrg
Date: 01/22/2014 09:12 AM

xplorer2-lite
http://zabkat.com/x2lite.htm
http://zabkat.com/comparison.htm (comparison table of xplorer2 versions v. Windows Explorer)


* I've used XYplorer Free edition as an alternative to Windows Explorer for years. It's very powerful and flexible. In my opinion it's far superior to Windows Explorer. However, I've not had to update in a looong time (I'm still using v5.55). I know that XYplorer Free can provide the end-result you're looking for. In fact, you can even custom select which of the file path/name/status components for output (e.g. path, filename, extension, modified date, and so on) thus removing all the rest of the clutter as desired from your search columnar output. I do that all the time time. But, the function can't be included in a batch file unless you use a keyboard/mouse macro script generator like AutoHotKey http://www.majorgeeks.com/files/details/autohotkey.html

Dr. Peaceful Jan 25, 2014, 05:25am EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: MSDOS Switch to suppress path
binar said:
Fellow Forum Members,
Using the MSDOS command below:

C:\Root>dir /b /s | more

Produces the list below on my monitor screen:
C:\Root>file1.doc
C:\Root>file2.doc
C:\Root>file3.doc
C:\Root>file4.doc

The problem is I don't want the "C:\Root" text to appear. I only want the "file#.doc" text to appear on my monitor screen. What switch do I need to use (besides /b & /s) to prevent the "C:\Root" text from appearing. In short, my goal is to only generate a list that creates a filename list without any path information included. Any info will be appreciated.

The /b option supposed to show bare format. If you use that alone, it will show just the filenames within the directory. However, use it along with /s (recursive), it's showing the directory path together with filenames, because you could have files with same names under different directories.

It may be possible to do it in DOS to strip the path, but it wouldn't be a one liner. You probably need to write a .bat file with some kind of loop. Time to use Powershell, it's the way to go for the future of Windows.

Here's the powershell command to do what you intended.
get-childitem -recurse | select-object name


john albrich Jan 25, 2014, 07:55am EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: MSDOS Switch to suppress path
Dr. Peaceful said:
Here's the powershell command to do what you intended.
get-childitem -recurse | select-object name


Any command that contains within it the explicit parameter "recurse", does not bode well. I suspect such can only "spawn" bad things :P

And to curse a child's beloved toy in what is clearly a Satanic rite (by invoking the object that must not be named)...well, that's just unspeakable...which is of course why I typed it.

binar Jan 25, 2014, 09:15pm EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: MSDOS Switch to suppress path
John and Dr. Peaceful,
Thanks to both of you for your posts. John I tried out Q-Dir since it's freeware and it has an EXPORT menu selection that accomplishes the same thing I'm trying to do using MSDOS. All it requires is to select files you want as text and then export selection as MicroSoft Excel. In short, it's a great little app. Again thanks for your post.

Dr. Peaceful Feb 02, 2014, 11:19pm EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: MSDOS Switch to suppress path
LOL John. ;) Hey don't blame me, blame Micro Sauce for their peculiar command names, as they're trying to sound Object Oriented.

Binar, you're welcome. Glad you find a solution.

Gerritt Feb 24, 2014, 09:20pm EST Reply - Quote - Report Abuse
Private Message - Add to Buddy List  
>> Re: MSDOS Switch to suppress path
It has been bloody forever sense I've scripted in MSDOS batching language, but I seem to remember there was an "exclude" option on the piped redirects to file or console or other output. You could exclude certain portions of output based upon the path or anything else.

Ad Astra Per Aspera
(A rough road leads to the Stars)
We all know what we know, and everyone else knows we are wrong.
System Specifications in BIO

Write a Reply >>


 

    
 
 

  Topic Tools 
 
RSS UpdatesRSS Updates
 

  Related Articles 
 
 

  Newsletter 
 
A weekly newsletter featuring an editorial and a roundup of the latest articles, news and other interesting topics.

Please enter your email address below and click Subscribe.