I want to create a list of all the files in a directory, without listing any of the subdirectories that reside in that same directory, and print that list to a new file.
ls -d * > filelist
will create a list of all the files in the current directory, but it also lists the subdirectories in the current directory.
I tried the find
command using the -maxdepth 1
option - however, the output format is a problem as find also prints out the path along with the file names.
If anyone can please tell me perhaps another command or options to use that will produce an output list of just the files in a directory and not the names of the subdirectories or their contents, I would appreciate it.
ls -d *
only list the files and folders in the current folder excluding hidden files/folders here;