![]() ![]() Print "NV Local A timestamp : " + str(os.stat(local_file).st_atime) Print "NV Local M timestamp : " + str(os.stat(local_file).st_mtime) Download skipped"ÄownloadAndSetTimestamp(local_file,fi,nt) If int(nt)=int(os.stat(local_file).st_mtime): #print "Local A timestamp : " + str(os.stat(local_file).st_atime) When you've done this, you should have a file structure like this: /addons/utime/lua/autorun/a Please note that installation is the same on dedicated servers.#print "Local M timestamp : " + str(os.stat(local_file).st_mtime) Installation To install Utime, simply extract the files from the downloaded archive to your garrysmod/addons folder. Print "File " + local_file + " already exists." Local_file = os.path.join(Target_dir,item,fi) Os.makedirs(os.path.join(Target_dir,item)) If not os.path.isdir(os.path.join(Target_dir,item)): Target_bug="Streptococcus_pseudopneumoniae" Print "Connected and Dir list retrieved." Print "-> atime after change : "+ str(os.stat(local_file).st_atime) Print "-> mtime after change : "+ str(os.stat(local_file).st_mtime) Os.utime(local_file,( int(nt), int(nt) )) #set the modification time the same as server for future comparison Print "-> atime before change : " + str(os.stat(local_file).st_atime) Print "-> mtime before change : " + str(os.stat(local_file).st_mtime) import ftplibÄef DownloadAndSetTimestamp(local_file,fi,nt):į.retrbinary("RETR " + fi, lf.write, 8*1024) Thanks in advance for any help in this problem. If you run the code bellow twice it will show the problem in the debug comments as the files in the FTP server didn't change but the timestamps don't match the local ones that were correctly changed. My problem is that as soon as I get out from the subroutine where I change the access and modification times they revert back to the original ones! I don't have anything running in background and I also tested the script on a linux server with the same results To achieve this goal I get the FTP file modification time, convert it to timestamp and then use os.utime to change the access and modification dates of the files downloaded to match the FTP server ones. If they don't match then I download the new copy. I'm trying to develop a script that downloads files from an FTP that match certain criteria but if the file exists and I already have a copy of it on a local dir then I want to check file modification times. Yes its on github, and although I don't really see myself updating it that much, I would recommend cloning it instead of just downloading the zip.I've came across a problem in python 2.7.1 (running on Mac OS X 10.7.5) with the os.utime command So there are now just the 3 columns (steamid, totaltime, lastvisit). I removed the ID column, and am using SteamID64's to identify players. Just drag and drop (or git clone) into addons folder and add your database info in lua/utime_a and thats it. (strangely enough) THIS REQUIRES TMYSQL4 TO BE INSTALLED!!! THIS IS MEANT TO REPLACE ANY EXISTING UTIME INSTALLATION!!! Have been doing gmod lua for quite some time now, and lately I have been hunting around for a UTime MySQL addon that just worked with no fuss, and short of (I posted in that thread as to my objections with it) there has nothing that has tickled my fancy, so I just made my own. Hey there guys, first release on these forums, well, first time ever on these forums.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |