Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ======Linux File Operations====== =====Find Directories Containing Specified File Glob===== For example, find directories containing Python source files. <code bash> find /c/home/db/ -type f -name '*.py' | sed -r 's|/[^/]+$||' | sort | uniq </code> * ''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. Find all the directories containing *.py files modified in the last 15 minutes. <code bash> find /c/home/db/ -mmin -15 -type f -name '*.py' | sed -r 's|/[^/]+$||' | sort | uniq </code> Find all the directories containing *.py files modified in the last 7 days. * This is helpful finding the recent things that have been worked on. <code bash> find /c/home/db/ -mtime -7 -type f -name '*.py' | sed -r 's|/[^/]+$||' | sort | uniq </code> List all directories modified in the last 7 days. <code bash> find ./ -mtime -7 -type d </code> Limit the recursion to only show directories in the current directory. <code bash> find ./ -maxdepth 1 -mtime -7 -type d </code> <code bash> find ./ -maxdepth 1 -type d -mtime -7 | xargs -I {} ls -dhl {} </code> ===== Mount CIFS/SMB Share ===== <code bash> sudo mount -t cifs -o username=admin,rw,iocharset=utf8,file_mode=0755,dir_mode=0755 //10.0.0.1/documents /mnt/win </code> linux/file_operations.txt Last modified: 2022/08/19 19:26by mgupton