This is an old revision of the document!


Linux File Operations

For example, find directories containing Python source files.

find /c/home/db/ -type f -name '*.py' | sed -r 's|/[^/]+$||' |sort|uniq
  • sed -r 's|/[^/]+$||' eats off the file name of a fully qualified file path, leaving only the path.
  • For each file path sed finds the filename and replaces it with a null string and the rest of the string/path is returned.
  • linux/file_operations.1493729901.txt.gz
  • Last modified: 2017/05/02 12:58
  • by mgupton