So working with the ALU chassis, its totally the most fun time of my life (scp locally doesn’t support wildcards or directories, thank god I could initiate it remotely).

I scp’ed over a bunch of files, cores, diags, and backups all with an awesome naming convention like so:

9-2backup-alu2.02001-10-1816-48-03-gmt.tgz 9-2backup-alu2.02001-10-1817-48-03-gmt.tgz 9-2backup-alu-core1.02001-10-0914-21-14-gmt.tgz 9-2backup-alu-core1.02001-10-0914-23-09-gmt.tgz 9-2backup-alu-diag1.02001-10-09_14-22-05-gmt.tgz

Where the basic number after “alu” is a backup, the core is a core, and the diag is a diag. Now I could have done something where I found all of what I actually want (the cores) and just moved them to a directory and then rm’ed everything else. Or, how I did it, was use find to delete the stuff I dont want.

find . -type f -iname "diag" -exec rm -rf '{}' . \; # takes care of the diag files find . -regextype sed -regex "./.backup-alu...*" -exec rm -rf '{}' . \; # takes care of just the backups :)

Thanks for the help: http://stackoverflow.com/questions/6844785/how-to-use-regex-with-find-command

Blog Logo

Mario Loria


Published

Image

./scriptthe.net

Because 127.0.0.1 gets old after a while.

Back to Overview