[Tutor] Move all files to top-level directory

Dotan Cohen dotancohen at gmail.com
Mon Apr 12 16:11:30 CEST 2010

I use this one-liner for moving photos nested a single folder deep
into the top-level folder:
find * -name "*.jpg" | awk  -F/ '{print "mv "$0,$1"-"$2}' | sh

I would like to expand this into an application that handles arbitrary
nesting and smart rename, so I figure that Python is the language that
I need. I have googled file handling in Python but I simply cannot get
something to replicate the current functionality of that lovely
one-liner. What fine manual should I be reading? I am not asking for
code, rather just a link to the right documentation.


Dotan Cohen


More information about the Tutor mailing list