Command to list only files omit directories.

Hi All I am writting a script that does a comparison between files in 2 diffectent directories.
To do this I need a command that will list out only the files in a give directory and omit any sub dorectories with that directory. But I am unable to find it.

Please Help.

I tried

ls "$directory1\*" | grep -v "^d" but that doesnt seem to be working. Please help.

Use find with -prune option.

Please use CODE-tags when posting code, data or logs for better readabilty, ty.

ls -F <path> | grep -v \/

Try this,

ls -p <Path> | grep -v "\/"

Please try any of these:

perl -e 'while (<*>) { print $_."\n"; }'
find dir -name "*" -type f -maxdepth 1
ls -l dir | grep -v '^d'

Thanks for your help guysssss!!!!!!!!!!!! it worked!!!