i was doing something thinking and wanted to understand if i could save information on to folder. I know i can do it in many steps, create the file, then move it to a folder. But is there a one step command ?
I tried something like this. Trying to get files/folder list and total number as well..that is why i use wc -l as well. how to combine these?
ls | wc -l > desktop_intel.txt foldername
I think it doesn't work. What if i want to safe this as text on a usb drive for instance ? Thank you !
If I'm understanding your question correctly, something like the following should work.
ls desktop/ > desktop/foldername/desktop_intel.txt
This assumes a desktop/
subdirectory is in your current directory.
Note in your example it's unclear what you're trying to accomplish with the wc -l
as there is no mention of needing a word count in your description.
If you want to save to a USB, you would need a path to the mount point (which is just a directory) for the USB drive, you can try commands like mount
and df
to get that path, and then redirect the output from the ls
command to that directory.