Search multiple directories and output file names
ls accepts more than one file/directory argument: try ls /directory1 /directory2 ... /directoryN
Edit: Also, executing several commands with independent targets after another doesn't work with pipes, but does with semicolons: ls /directory1; ls /directory2; ...
.
Related videos on Youtube
user3299009
Updated on September 18, 2022Comments
-
user3299009 over 1 year
I have a list of 7 directories. Every day they get a file. I would run one command that would check all the directories at once which provides the output of the file names.
Normally I run
ls /direct1
to each of the 7 directly and honestly I tried piping all those command together but that doesn’t work either. I really don’t mind trying to figure things out on my own but I am just not sure what to search for. Most of my google results have point to scripts that would include the file names but that really seems like overkill. Maybe that's the only way and the reason for those results.-
user3299009 over 7 yearsChanged comment to: Pardon my ignorance. I see what you mean. That will help after our migration.
-
-
user3299009 over 7 yearsWOW. Even easier than I was trying to make it. It seems like I should have known that as I use 'mv' to move multiple files. I dont pipe those....anyway, thanks!! have a wonderful day.
-
user3299009 over 7 yearsoh, that is why that was suggested. I think after our migration that would apply. Thanks for that suggestion.