File handling refers to the set of tools, functions, and libraries to work with files and file handles. Creating, writing, appending, moving, and deleting files fall in this domain.

learn more… | top users | synonyms

0
votes
0answers
13 views

Bi-directionally synchronize/mirror folders over the internet

I am programming on the C# stack, but I have next to none Azure experience. We have several customers who have various processing needs on data files that reside at the customers computers. We want ...
0
votes
0answers
34 views

Why do I get a memory error using .next()? [migrated]

I'm trying to parse a text file in python 2.7. The file has has around 10^11 lines so I can't load it into memory. This works just fine: with open('file_name.txt') as f: for row in f: ...
19
votes
4answers
527 views

Using flat files vs database/API as a transport between a frontend and backend

I've got an application which has generated a rather heated discussion between a couple of the developers. Basically, it's split into a web layer and a backend layer. The web layer collects ...
6
votes
1answer
187 views

Is there a standard way of cleaning data files?

Having spent quite a lot of time working in software companies that deal in medium to large data sets, I've seen that a choke point in their processes is often prepping data files for loading into ...
3
votes
2answers
596 views

Why do binary files load quicker than alphanumeric text files?

I've noticed that when I load/store large data files in a binary format, the program runs much faster than if I load data from an ASCII encoded file. Why is this the case? The data in my case is ...
9
votes
5answers
3k views

Test Driven Development: A good/accepted way to test file system operations?

I am working on a project at the moment that generates a table (among other things) based on the contents of a file-system, and in turn does some meta-data modifications on the things it finds. The ...
7
votes
2answers
199 views

How to distinguish whether a file is being saved or deleted? (“Save” in MS Word deletes then re-creates)

I maintain a tool that syncs files between a client computer and a document management server (using the CMIS protocol). Versions history (on the CMIS server) is important. When saving a document ...
2
votes
1answer
57 views

Writing Automated test cases for a folder Archiving Class.

Using C# and Visual Studio, I've developed a class that zips and archives a folder into desired location, creating directories and manipulating files on a machine. The intended use is as an part of ...
3
votes
1answer
167 views

Forward Slash vs Back Slash vs File.separator in Java

I've seen some programmers doing the following : File file = new File("folder\\subfolder\\subsubfolder"); And I find it totally wrong because of compatibility issues with a different OS than ...
65
votes
6answers
5k views

Should temporary files be saved to /tmp or the current working directory?

I have a program that needs to generate temporary files. It is written for cluster machines. If I saved those files to a system-wide temporary directory (eg: /tmp), some users complained the program ...
9
votes
4answers
432 views

Should the creation of an object implicitly or explicitly create a file?

I'm creating an object whose sole purpose is to read in a file of one format and create another of a different format. Is it best to create the output file implicitly during object initialization or ...
3
votes
1answer
164 views

What is the most sensible design for making files available for download from a URL?

This is what I need to do, in a nutshell: Generate Excel spreadsheet files (programmatically). Store these .xlsx files in a location where they can be accessed by users later. These files need to ...
1
vote
2answers
362 views

Uploading files(code) on a web server?

I have a very small and basic web site on a web server. Usually I'm doing the changes on a localhost where the development version is, and after that I upload it to the server with FileZilla. That's ...
1
vote
2answers
152 views

How are non-folder files called? [closed]

Maybe it looks like a weird question, but what term should be attributed inside the code for files that are not folders to differentiate them from folders? If I need write 2 functions isFolder() and ...
0
votes
2answers
173 views

Undo/redo implementation for file changes in PHP

I was thinking to store all file operations inside an array, along with the reverse operations which are used for undos. Example: [ [ 'op' => 'move', 'parameters' => [$path_from, $...
14
votes
4answers
7k views

What's the best practice for naming uploaded images?

Suppose I have a form in my web application where users can upload a profile picture. I've got few requirements about file size, dimensions etc, but when the user uploads the image, how should I name ...
28
votes
3answers
10k views

Should I pass in filenames to be opened, or open files?

Suppose I have a function that does things with a text file - for example reads from it and removes the word 'a'. I could either pass it a filename and handle the opening/closing in the function, or ...
1
vote
2answers
54 views

Can version control systems use the filesystem log to capture changes?

I was trying to find a "perfect" syncing program between a network share and a local folder, when I realised that it's probably impossible to do it right unless all the filesystem operations were ...
3
votes
1answer
56 views

Is there a convention for where to store crash-recovery files?

I work on an application where we have the potential to attempt a file save in the top-level exception handler. The intention would be save a file which can then be sent into the support team, ...
0
votes
1answer
51 views

Handling Upload Of Unknown File types

A support ticket has been raised whereby a mac user saved a file from an email, then uploaded it to our web based system. By default, when doing this the mac does not save the file with a 3 letter ...
3
votes
2answers
1k views

How does printf write to stdout? [closed]

I've been looking for an answer to this for a couple days, and all of the results I've come up with are about how printf accepts an arbitrary number of arguments. How does printf write to stdout? ...
2
votes
1answer
103 views

Handle files on a remote location

Our intranet application is used to document and store office files. Both app and server are hosted remotely on the same server. Due to fact that our app server is changed every couple of years, we ...
0
votes
1answer
101 views

Working with external translators in .NET

I am working on a .NET project (happens to be an MVC website) that is being deployed in 5 languages. We have several hundred text strings in various .resx files, which is working great. However, the ...
12
votes
7answers
3k views

Is it necessary to read every single byte to check if a copied file is identical to the original?

I recently learned of a program called Total Commander. It's a Windows Explorer replacement and has its own stuff to copy files. To check whether the files are identical, instead of calculation a CRC, ...
1
vote
1answer
46 views

How to deal with dual servers and temporary files

Our application is hosted on a dual-server environment - when one server is overloaded with work, a secondary server will take its place in processing certain actions. For most purposes, this isn't a ...
6
votes
3answers
347 views

Where in an MVC web application should writing files locally go?

In my web application that uses an MVC framework which has different modules for models, views and controllers I talk to several databases and APIs. Those are implemented as individual models. A lot ...
0
votes
1answer
63 views

What locking mechanism should be used when persisting data to files

I am beginning to learn how to create web applications from a golang tutorial. For simplicity, it persists data to files instead of a database. The complete code creates a server that can handle ...
9
votes
3answers
604 views

What is a good design for allowing backwards compatibility of files between different versions of software?

What is a good design for allowing backwards compatibility of a file type between different versions of software? For instance, how does microsoft get word 2007, 2010 and 2013 etc... to all open docx ...
7
votes
1answer
1k views

“Read” a file without using a file pointer

I was asked this question in an interview. I'm somehow supposed to "read" a file into my C program as input without using a file pointer (including "f" functions, e.g. fgets, fscanf etc.). I'm also ...
0
votes
0answers
40 views

Uploading Named Binary Tag files(NBT) via PHP - a bit scared security wise

I'll cut right to the chase. I'm building an application that deals with NBT files(named binary tag). They are being uploaded via the usual PHP methods. I haven't dealt much with uploading files in ...
0
votes
0answers
75 views

Handling image and audio files in iOS

Currently I have an iOS app that downloads image and audio files from a server, but each view controller downloads its own set of image and audio files (This is because each view controller needs a ...
5
votes
2answers
692 views

Hard Coded File Paths - Solution?

Say you have an application that saves image(.jpg, .png etc) and text(.txt, .xml) files, and the application has all of the files paths hard coded throughout code, per the example below. Assuming the ...
8
votes
9answers
5k views

Multithreaded file copy

There is an utility we have which is used to upload files (and perform other operations on the file) to a network shared location. The file size tends to vary from a few mb to 500 mb. A suggestion has ...
0
votes
2answers
120 views

Is renaming an 'alias' for moving?

Is it true to say (on Windows and Unix\Linux\OS X) that renaming a file or directory is just an alias for moving? e.g. Are there any side effects to either which are not present on the other? Does ...
40
votes
2answers
3k views

What is the benefit of writing to a temp location, And then copying it to the intended destination?

I am writing an application that works with satellite images, and my boss asked me to look at some of the commercial applications, and see how they behave. I found a strange behavior and then as I was ...
0
votes
1answer
710 views

Elegant way to count the number of files in Zip archive

I need to count the number of files in several zip archives for error checking. I've found several answers on SO but nothing elegant. I currently have the following code which works but it's not ...
0
votes
1answer
1k views

Using XML to store and edit data records in Java

I want to use XML to store data for an assignment . In this Java assignment I'll get data from the user in form of lines in a file below INSERT INTO student(id,name,family,isMale) VALUES (10,null,”...
0
votes
0answers
74 views

How to design a server that does not interrupt downloads?

I'm building a Node server that serves large files for download and streaming. It will be necessary to modify these files on occasion, sometimes in bulk with a script. I want to be able to update them ...
0
votes
1answer
310 views

Making a database and related operators using files and JSON in java [closed]

I'm trying to write a program that reads operations from a file. these operators look like below : CREATE TABLE student(id:integer, gpa:decimal, name:string, family:string,isMale:Boolean) INSERT ...
4
votes
2answers
341 views

Design, how to utilize The Hardware (multiple threads and/or GPU) while indexing (via a database) a very large set of binary files

Problem How can design my file parser to maximize the hardware when processing (creating meta data for) a large file (i.e. how to avoid being blocked by IO and running out of memory) preferably ...
-1
votes
1answer
599 views

Laravel - BLOB File Management System - Possible obstacles?

I'm working on this weird project where I need to upload huge files (500mb+) and store them in a postgresql table as a blob. Before you start telling me that storing files in the database is bad and ...
1
vote
3answers
245 views

Which part of the code should rewind a file pointer?

If you had a function that took a handler to a file and then performed some actions that moved the pointer, would you expect it to put the pointer back when it was finished? Additionally, would you ...
0
votes
2answers
518 views

Serving a file from a private directory [closed]

I have a PDF that needs to be accessible for multiple unrelated areas across a website. I don't want to reveal anything about where the file is downloaded from and I want to only upload the file once. ...
1
vote
2answers
473 views

Is there actually an advantage to using Win API calls for file access?

I remember coding file access using the Win API about 15 years ago. It was much faster than using the FileStream of my language at the time (Delphi). I spent a while today experimenting in C# under ....
1
vote
2answers
487 views

TDD and Writing Tests for File Processing

These questions are very similar: TDD for batch processing: How to do it? and TDD: how to test file outputs? but I'm still left wondering some things The app processes files/pdfs. It takes them from ...
0
votes
1answer
98 views

Is it possible to save and load a decorated object

I am wondering if there is an easy way to save and load a decorated object in c++ as i have never done file handling in C++ before. Currently the only object type I need to save is objects that ...
2
votes
3answers
107 views

Smart fallback for line endings in code files? [closed]

What do you recommend as a default fallback for line endings if the operating system cannot be determined? Example Mac OS up to version 9 uses carriage returns (\r) for line endings. Unix-like ...
1
vote
1answer
86 views

Holding of files being edited in a text editor

I'm writing an implementation of Ex (hopefully Vi eventually) as a personal project. I need to somehow store an identifier for the file associated with each buffer. In terms of security/race ...
2
votes
2answers
218 views

Recreating files from shell script or java?

I have java application which takes a file, which is created by a process running on terminal. I start the process using a small shell script. Then run the Java application and it reads the file ...
0
votes
2answers
203 views

Whats a good structure to save and retrieve locations of images?

I got a java-ee application, where I collect informations about movies. Im my backend I provide data like the name, description, genre and a random uuid. I also got lots of related files, which are ...