There is also an option to have the server place before the servers hostname, which will let players know what is going on. A password is then placed on the server, and should not be changed to allow joins during the uploading process. This is to prevent any data altercation during upload, ensuring a safer upload. Doing this will EMPTY your server completely, as well as put a password on it. Running the command "uploadutime" will begin the process of uploading your data to the MySQL database. This works by running a simple console command, and ensures that it is nearly impossible for anything wrong to happen. Updated UI to be the same as the normal versionīiggest addition is the ability to upload current data from the server's sv.db file to the MySQL database and have it begin to use the MySQL data. Added color coding for the console messages Removed the two pointless table additions (steamid and playername) It's been quite a while since the last release of a Utime MySQL addon/update, so I decided to bring mine to the table. Nt = datetime.strptime(mt, "%Y%m%d%H%M%S").NOTE: This is officially outdated. 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) #print "Local M timestamp : " + str(os.stat(local_file).st_mtime) 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. I've came across a problem in python 2.7.1 (running on Mac OS X 10.7.5) with the os.utime command
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |