K
Kamus of Kadizhar
Thanks to everyone on this list. I now have a functioning piece of
python code!! )
Now I'm trying to clean it up.
I have the same (or similar) lines repeated several times:
shutil.copy2(newArrivalsDir+'/'+movie,archivesDir)
thumb = string.replace(movie,'.avi','.jpg')
shutil.copy2(newArrivalsDir+'/tn/'+thumb,archivesDir+'/tn/')
or
os.rename(otherFavDir+'/'+movie,dir+'/'+movie)
thumb = string.replace(movie,'.avi','.jpg')
os.rename(otherFavDir+'/tn/'+thumb,dir+'/tn'+thumb)
what varies is the name of the function (shutil.copy2 or os.rename
depending on if I am renaming or copying) and the names of the source
and dest directories. This particular snippet is repeated about a
half-dozen times.
It would be nice if I could write a function that would determine if the
source and destination are on the same file system or not, and thus use
rename or copy appropriately, or if there is already such a built-in
function.
TIA,
-Kamus
python code!! )
Now I'm trying to clean it up.
I have the same (or similar) lines repeated several times:
shutil.copy2(newArrivalsDir+'/'+movie,archivesDir)
thumb = string.replace(movie,'.avi','.jpg')
shutil.copy2(newArrivalsDir+'/tn/'+thumb,archivesDir+'/tn/')
or
os.rename(otherFavDir+'/'+movie,dir+'/'+movie)
thumb = string.replace(movie,'.avi','.jpg')
os.rename(otherFavDir+'/tn/'+thumb,dir+'/tn'+thumb)
what varies is the name of the function (shutil.copy2 or os.rename
depending on if I am renaming or copying) and the names of the source
and dest directories. This particular snippet is repeated about a
half-dozen times.
It would be nice if I could write a function that would determine if the
source and destination are on the same file system or not, and thus use
rename or copy appropriately, or if there is already such a built-in
function.
TIA,
-Kamus