I am trying to print the list of all files and folders including hidden files:
ls -al | awk -F' ' '{print $9}' | xargs do_something
However, some of the files and/or folders contain space characters. How could I achieve this? Thanks.
>Solution :
$ find . -mindepth 1 -maxdepth 1 -printf "%P\n"|xargs -i sh -c 'echo found: "{}"'
found: file2
found: folder 2
found: folder
found: file 1
$ ls |awk '{print}'|xargs -i sh -c 'echo rm -r \""{}"\"'
rm -r "file 1"
rm -r "file2"
rm -r "folder"
rm -r "folder 2"