[23:30:23] <Vasistha> Jzarecta: yeah, exactly: -exec echo rm … [23:31:12] <overdub> yitz_: if you’re going to remove the directory, where is the file supposed to go? [23:31:26] <overdub> you’d have to move relevant files out to a new directory first [23:31:56] <Vasistha> bouma: well, my inclination for you is to use “find” and pipe the results, however when doing so you have to be very careful about file names possibly containing white spaces [23:32:20] <Vasistha> bouma: there are ways to make it work in spite of that; however sometimes one can be quite certain there are not any files with spaces in their names [23:32:53] <Vasistha> bouma: the other concern is getting everything in the right order; find doesn’t always list things in the same order as e.g. ls [23:33:18] <Vasistha> bouma: actually perhaps ls with xargs could serve you — provided you’re 100% certain no file names have embedded spaces or other funky chars [23:33:30] <yitz_> Vasistha: What are you tring to accomplish? [23:33:45] <yitz_> Erm. Jzar. He’s gone, eh? [23:34:38] <yitz_> There’s no reason to use xargs when you got find and parsing ls output is usually a bad idea. If you want a file list, use a glog [23:34:41] <yitz_> glob [23:35:24] <Vasistha> yitz_: well, find makes subshells, so counting doesn’t work [23:36:14] <yitz_> Counting..? Are we back to the ln issue or on the rmdir issue? [23:37:52] <Vasistha> yitz_: what bouma asked about. I’m coming back to the for statement, it’s gotta be the best way [23:38:43] <Vasistha> x=0; for i in *; do echo mv $i $((x++)).jpg; done [23:38:54] <yitz_> Yeah. The for loop out to work fine. If you need variable depth, there’s starglob or globstar
Nov 282011