Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question comes close but it winds up playing a file find operation for all such named file names.

I'm however looking to do a directory contents diff comparison with a directory on a Windows machine and compare it to what should be a similarly constructed directory on a QNX box. I want to run the directory enumerating command on both machines, do some text file manipulation to convert path delimiting characters and root drives and what not to get them into a compatible format for an insightful diff.

I can generate a folder manifest of all subdirectories and files therein with dir /b /s, and get output formatted as a bunch of paths...

c:\Temp>dir /b /s
c:\Temp\Subfolder1
C:\Temp\Subfolder1\File1.txt
C:\Temp\Subfolder1\File2.txt
...

I can see dir /s becomes ls -R, but how do I get the /B equivalent of the path output formatting?

share|improve this question
2  
The answer is the same as in the other question, except you leave out the -name option, so it doesn't filter by name. – Barmar 6 hours ago
up vote 7 down vote accepted

find may give you all that you need. It has a little more overhead as it performs more tests than ls alone, but if you want the path information in the output then this may be the simplest way to achieve that.

If you're going to compare two systems, then you should probably do some text editing first and swap \ with /, and remove the C: prefix. Then sort the lists and use diff to spot the changes. sed will be your friend here. Follow-up with a comment if you want this too.

share|improve this answer

There isn't a flag for ls which will do what you ask, but you can accomplish it with several other tools, the easiest being (possibly) find:

find .
share|improve this answer
1  
or simply find The default expression is . – user4556274 6 hours ago
2  
True. Anyway I think it is a good practice to include defaults in Q/A posts, as they might not be obvious to everyone. – Bruno9779 6 hours ago
8  
@user4556274 It may be for GNU find, but other implementations follow the POSIX standard and requires a directory operand. – Kusalananda 6 hours ago

In order to get the actual path prefixed (assuming that's important), do

find `pwd`
share|improve this answer

tree -if

-i to not indent -f to print path

share|improve this answer
    
Interesting, show some console output to your answer; I can't find that command from my QNX box -bash: tree: command not found – jxramos 2 hours ago
    
I'm on my phone so can't test it, but it's in the man page at linux.die.net/man/1/tree – Stephen C 2 hours ago
    
It's from mama.indstate.edu/users/ice/tree, and packaged as tree in a number of Linux distributions. – deltab 28 mins ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.