how to determine if files are on same or different file systems

Kamus of Kadizhar yan at NsOeSiPnAeMr.com
Sat Dec 6 23:15:42 CET 2003


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

-- 
What am I on?
I'm on my bike,                         o__
6 hours a day, busting my ass.          ,>/'_
What are you on? --Lance Armstrong     (_)\(_)





More information about the Python-list mailing list