Saturday, October 3, 2009

A short script to move files out of the way retaining full path

Find all files named *.fast4 under the current directory. Create replicate the path under ./obsolete and copy the file to the associated location. This script creates the required commands in a file called "moveobsolete" which you can then check over and execute.

find . -name "*.fast4" > obsoletefiles
awk '{print "mkdir -p ./obsolete/`dirname "$1"`; mv " $0 " ./obsolete/" $0}' obsoletefiles > moveobsolete
chmod 777 moveobsolete

No comments: