Finders

  • Find and execute

Find and execute

# find all files in subfolders of /dir1 and move to /dir 
find /dir1 -mindepth 2 -type f -exec mv -t /dir1 -i '{}' +


#find ascii files containing db
find . -name "*.R" -print | xargs grep "db"

# find files newer than (m = mod time t = ref interpreted as directly as time)
find . -newermt "2016-12-06"

# find files created on 14 october
find . -maxdepth 1 -newermt "2019-10-13" ! -newermt "2019-10-15"

# get all directories created after date x and show basename
find . -maxdepth 1 -type d -newerct '11/30/2019 0:00:00' -exec basename '{}' \;