filesize

Keeping log files under a certain size

倾然丶 夕夏残阳落幕 提交于 2019-12-05 06:23:06
I have an application that is running on a stand-alone panel PC in a kiosk (C#/WPF). It performs some typical logging operations to a text file. The PC has some limited amount of disk space to store these logs as they grow. What I need to do is be able to specify the maximum size that a log file is allowed to be. If, when attempting to write to the log, the max size is exceeded, new data will be written to the end of the log and the oldest data will be purged from the beginning. Getting the file size is no problem, but are there any typical file manipulation techniques to keep a file under a

Delphi Function to Display Number of Bytes as Windows Does

淺唱寂寞╮ 提交于 2019-12-05 06:16:25
This is a simple one (I think). Is there a system built in function, or a function that someone has created that can be called from Delphi, that will display a number of bytes (e.g. a filesize), the way Windows displays in a file's Properties box? e.g. This is how Windows property box displays various sizes: 539 bytes (539 bytes) 35.1 KB (35,974 bytes) 317 MB (332,531,365 bytes) 2.07 GB (2,224,617,077 bytes) The display is smart about using bytes, KB, MB or GB, and shows only 3 significant digits for the KB, MB and GB. It then follows that by displaying the exact number of bytes in parenthesis

Can I increase maxRequestLength of ASP.NET request for MVC Controller Action with additional parameters?

帅比萌擦擦* 提交于 2019-12-05 06:02:59
Can I increase maxRequestLength of ASP.NET request for MVC Controller Action with additional parameters? I have a UploadController with a ActionResult looking somthing like this. [HttpPost] public ActionResult VideoUpload(int memberId) { var status= _docRepo.SaveDocument(DocumentType.Video, Request.Files, memberId); return Json(new { success = true, status = status}); } The files can be very large, i have increaset maxRequestLenght in web.config and can upload the files, but im worried about the security issue. So i tried this and its not working: <location path="VideoUpload"> <system.web>

Why are FAT32 disks limited to 4GB files?

我只是一个虾纸丫 提交于 2019-12-05 00:31:15
I'm not looking for a workaround; I'd like an explanation. Most of the links I found through Google just tell me that the file limit is 4GB, but not why. I am aware of the explanation by Wikipedia: http://en.wikipedia.org/wiki/File_Allocation_Table#FAT32 But this still does not go into detail about why. (What does SCANDISK have to do with it?) Maybe then I will understand whether it's possible to overcome the 4GB file size limit. To extend that answer, FAT32 is derived from FAT16 and FAT12. When FAT12 was introduced, PCs ran a 16-bit OS, and there were no drives larger than ten megabytes. I

How to get image size (bytes) using PIL

风流意气都作罢 提交于 2019-12-04 22:54:11
I found out how to use PIL to get the image dimensions, but not the file size in bytes. I need to know the file size to decide if the file is too big to be uploaded to the database. Try: import os print os.stat('somefile.ext').st_size If you already have the image on the filesystem: import os os.path.getsize('path_to_file.jpg')` If, however, you want to get the saved size of an image that is in memory and has not been saved to the filesystem: from io import BytesIO img_file = BytesIO() image.save(img_file, 'png') image_file_size = img_file.tell() This method will avoid multiple reads of the

Is there an upper limit on .txt file size?

走远了吗. 提交于 2019-12-04 22:38:27
As a Christmas gift I have written a small program in Java to calculate primes. My intention was to leave it on all night, calculating the next prime and writing it to a .txt file. In the morning I would kill the program and take the .txt file to my friend for Christmas. Is there anything I should be worried about? Bear in mind that this is true beginner Ziggy you are talking to, not some smart error checking ASM guy. EDIT More specifically, since I will be leaving this program on all night counting primes, is there any chance at all that I will encounter some kind of memory related error?

how to check file exists and get file size by substring?

﹥>﹥吖頭↗ 提交于 2019-12-04 22:09:58
I have a directory will create every day file like '2018-08-14-9-22-4', the file name created is by yyyy-mm-dd-h-m-s, how to check file is exists by substring like '2018-08-14' ? and get the file full name and file size ? my $file = "$yy-$mm-$dd-$hh-$mm-$ss"; my $path = '/home/httpd/doc/$user/$year/[every day file]' Simplest way would be to use the pattern matching in glob , and then use stat on the file. for my $name ( glob('2018-08-14-*') ) { my $size = ( stat($name) )[7]; say "name is '$name', size is $size bytes"; } or better yet... use File::stat use File::stat; for my $name ( glob('2018

python urllib2 download size

假如想象 提交于 2019-12-04 20:33:15
iwant to download a file with the urllib2, and meanwhile i want to display a progress bar.. but how can i get the actual downloaded filesize? my current code is ul = urllib2.urlopen('www.file.com/blafoo.iso') data = ul.get_data() or open('file.iso', 'w').write(ul.read()) The data is first written to the file, if the whole download is recieved from the website. how can i access the downloaded data size? Thanks for your help Here's an example of a text progress bar using the awesome requests library and the progressbar library: import requests import progressbar ISO = "http://www.ubuntu.com

The best way to get the file size which greater than 2GB in php?

℡╲_俬逩灬. 提交于 2019-12-04 17:10:22
I want to check the file's size of local drives on windows OS .But the native PHP function filesize() only work when the file size less than 2GB . The file which greater than 2GB will return the wrong number.So,is there other way to get the file size which greater than 2GB? Thank you very much!! Jim W. You can always use the system's file size method. For Windows: Windows command for file size only? @echo off echo %~z1 For Linux stat -c %s filenam You would run these through the exec php command. yes123 this function works for any size: function fsize($file) { // filesize will only return the

Swift - Get file size from url

六眼飞鱼酱① 提交于 2019-12-04 16:59:53
问题 i am using documentPicker to get url path of any document and then uploaded to the database. I am choosing file (pdf, txt ..) , the upload is working but i want to limit the size of the file . public func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL) { self.file = url //url self.path = String(describing: self.file!) // url to string self.upload = true //set upload to true self.attachBtn.setImage(UIImage(named: "attachFilled"), for: .normal)//set