How to get full path of a file?

后端 未结 30 3282
走了就别回头了
走了就别回头了 2020-12-02 03:22

Is there an easy way I can print the full path of file.txt ?

file.txt = /nfs/an/disks/jj/home/dir/file.txt

The

30条回答
  •  天命终不由人
    2020-12-02 04:03

    Works on Mac, Linux, *nix:

    This will give you a quoted csv of all files in the current dir:

    ls | xargs -I {} echo "$(pwd -P)/{}" | xargs | sed 's/ /","/g'
    

    The output of this can be easily copied into a python list or any similar data structure.

提交回复
热议问题