Questions tagged [file-structure]
A file structure is a way of organizing files in a fashion that allows them to be queried and/or updated efficiently. **Please do not use this tag to ask about project structure.**
50 questions
2
votes
1
answer
75
views
Ruby 'mkdir_reports'-script for creating folder-/file-structure automated
Initial situation: Each week a nested folder-/file-structure has to be created. Content is added to the files. Afterward the structure is copied to a shared-folder for long-time documentation.
Example:...
1
vote
1
answer
152
views
Looking for help simplifying a general purpose compression function
The following is a general purpose file compression function with the following features:
It can take either a single file or directory as the source input
It defaults to the source directory when to ...
4
votes
2
answers
221
views
Add offset to all filenames
From all the files in a directory, the method shiftFilenamesOffset is to increment the numeric part (int) of the alphanumeric filename by offset each time, and ...
2
votes
2
answers
257
views
Duplicate a folder tree over a network in C#
I have been tasked in creating a method that would replicate a full directory tree to a remote server using C#. The problem there is that I can only create the folder or the file if it has a parent.
I'...
3
votes
1
answer
107
views
Bash script to clone directory structure with renaming
I've written a script to aid in creating new watchfaces for the awesome AsteroidOS project. A watchface there typically consists of directory structure like this:
...
2
votes
3
answers
340
views
Java logger (of doom!), updated
In a previous question, Java logger (of doom!), I had posted my own logger, written in Java. I have since taken the answers from that question and a few of my own things to update it.
New code:
...
13
votes
7
answers
3k
views
A binary 3D model format for a game
I've recently started working on my own game engine and I have been thinking about creating my own model format. Since text usually takes a long time to load and process I decided to make a binary ...
8
votes
3
answers
591
views
Sinclair Spectrum TAP file dumper
The other day, I had occasion to want to look into an ancient piece of Z80 software written for a Sinclair Spectrum computer. Software for this machine was typically saved to audio tape, and today ...
1
vote
2
answers
106
views
Building a Building - Is the building clean?
I'm writing a small game and I use Kotlin for that. I want to model my buildings with the following class:
...
6
votes
1
answer
130
views
Centrepiece Class from a Warehouse Management Package
Overview
I've just written a package in Python (which I've named sibstructures) whose purpose is to assist staff in managing a coldstore, which is a warehouse-...
4
votes
1
answer
285
views
Read JPEG dimensions properly
I need to extract the dimensions (width and height) of a jpeg file for inserting in an html document. According to the JPEG image compression FAQ, cautions against what's commonly out there,
Some ...
6
votes
2
answers
4k
views
Java program to detect the Java class File Format magic number, in a given file
Description:
I wrote a Java program that checks whether the content of the given file begins with the Java class File Format magic number 0xCAFEBABE, in big-endian ...
7
votes
1
answer
1k
views
Parse a WAV file and export PCM data
I'm a newbie and I wrote code that gets a WAV file and exports a RAW (only PCM data) to *.raw file. But I am confused about the structure. The code is written as one procedure (LISP style) and there ...
4
votes
2
answers
252
views
Parsing Bitcoin binary data file with Python
The script parses Bitcoin database (blkXXXXX.dat) files directly from raw binary to txt human readable view. And I think about how to encrease the speed of processing.
Can anyone suggest how to ...
5
votes
3
answers
178
views
Serial copying from disk images to folder in Bash
This is a Bash script that copies files stored inside disk images to a directory, using a defined structure provided via a JSON file. I've included the external programs it requires and the test I ...
2
votes
0
answers
215
views
DOS header parser in Rust
Looking for feedback mostly on the from() and printf() implementations but I included everything for context. Please do not ...
4
votes
1
answer
247
views
Updating data file records
I learnt to code a long, long time ago.
Concerns
Existing approach is messy and will be hard to maintain. System errors are not trapped and the error messages could be better implemented. Final ...
2
votes
0
answers
154
views
Parse Mach-O binding info
I wrote this C program to open a Mach-O executable/framework and parse the external symbols along with their respective framework/library. A few things I would like to get better at:
Memory management:...
7
votes
1
answer
521
views
Binary test file generator with checksum
In reading this question, it occurred to me that it would be helpful to create test files according to the file format specification. To recap, the file format is as follows:
File format
Note that ...
14
votes
1
answer
397
views
Code to fill PE import address table
I wrote a program to test AV engines against encryption. When it runs, it will compute some key, decrypt an executable it has in its data section and copy it to the locations where the executable ...
3
votes
1
answer
656
views
Restructuring a file to JSON
I created a program that parses a Credit Reporting file which is in the Metro 2 file format as described here. Parsing a file is generally trivial but the issue is that in this case, there are no ...
4
votes
1
answer
829
views
C program that recovers lost JPEG files
My overall strategy is to load a block size (512bytes) into memory and check if that blocks first 4 bytes match a JPEGS first 4 bytes.
If it does then, I'll open a new out file and start writing the ...
3
votes
1
answer
130
views
Adding a new node in an AVL tree
I was working on a class assignment today and I wrote this code which works perfectly fine. It looks tho kind of has too much 'if statements' in it, and I was thinking that it could be written much ...
1
vote
1
answer
109
views
Ad-hoc analytics script to module/package
I have a text analytics process that I complete for work. This process mines text for different Twitter accounts and finds patterns in the tweets. The actual machine learning pipeline is much more ...
4
votes
2
answers
1k
views
In-place sorting of a binary file using heapsort
I have been working on sorting a file in-place with heapsort. I'm very glad it is working. But the time it takes is just too much. So I was wondering on how I could improve it.
Here are my ...
11
votes
2
answers
1k
views
Reading a repetitive file with repetitive code
I made this code for take some data from a .txt file. The text file is a large list of data from temperature with a format that is repetitive and have some lines at the beginning with the station ...
14
votes
2
answers
3k
views
Regex Matching a Naming Convention
Program Purpose
So, I have a naming convention for certain folders.
I want to take in a folder name, and determine if it conforms to the convention.
Naming Convention
The convention (case ...
6
votes
2
answers
160
views
Validating FileSystem Structure
I have a File System. It is *supposed* to be laid out / used / added to in certain ways.
This is a program to report on the *actual* state of the file system versus what it's supposed to be.
In ...
9
votes
2
answers
1k
views
Reading binary files in XTF format
I have a few thousand binary files that have corresponding structs in them, followed by any number of bytes (this exact number of bytes is given in one of the fields in the structs). I read in data ...
4
votes
1
answer
318
views
Marshaling data for a game
I've been working on a game that I used to play as a kid. This game was disassembled then converted to C# by someone else and they hosted it on Github. I've forked it and started working on it some. ...
4
votes
1
answer
128
views
Extract PNGs embedded in a file
My approach was to find each occurrence of the PNG's file signature followed by its end of file (EOF) and write the bytes between to a new file whose name is simply a counter starting at zero.
...
7
votes
2
answers
207
views
Parsing 4 Million Filenames
This is the next step in my project to query Companies House records. The first step, retrieving and validating the company numbers to be targeted, was covered here and I will include that code at the ...
6
votes
2
answers
204
views
Using PHP to create a file structure
I am using PHP to create a file structure in which to store XLSX files, for this I have created this class:
...
6
votes
1
answer
203
views
Pulling PE32 header info
Context Info
I coded up a program that maps an executable file(.exe .dll mainly) to the program's memory space which allows for easier extraction of the PE header info. I extract the information by ...
7
votes
1
answer
175
views
Nothing compiler/interpreter, Part 2
Part 1
I've followed some of the suggestions:
Adding newlines to error messages
Implementing options (I decided to use boost instead of getopt)
Using strerror for fstream failure
Allow multiple files ...
4
votes
1
answer
6k
views
Makefile for compiling shared libraries
I have a makefile that I've been using to compile my shared libraries which reads in the files from different folders and then builds the objects and binaries in their own folders.
The folder ...
2
votes
0
answers
896
views
Simple clicker game
I have started my clicker game using angular.js about week ago. I have finished current functionality first night, but still have feeling of misunderstanding some basic approaches.
This is sources ...
4
votes
1
answer
1k
views
Key value flat file system - single header INI replacement
I'm very happy with the performance, but I always try to optimize my code as much as possible. Since I plan on using the code in production, I feel more save posting it here first. I probably missed ...
3
votes
1
answer
4k
views
Creating a directory structure from JSON
I have a JSON file:
...
2
votes
1
answer
521
views
Parsing oscilloscope data, follow up
Follow-up up on Parsing oscilloscope binary data.
I wrote a simple parser for Tektronix's internal file format .isf.
I revised my code to the following:
...
8
votes
3
answers
2k
views
Parsing oscilloscope binary data
I wrote a simply parser for Tektronix's internal binary file format .isf. The code is supposed to read in the file and return the header data as well as the actual ...
4
votes
1
answer
380
views
Huge terminal game (in development)
I'm developing a big (for me, as a beginner) terminal program "Brainfuck - The Game", in which you have to complete Brainfuck challenges. I would like your review on existing code (and project ...
8
votes
4
answers
6k
views
Reading a text file that contains several CSV-like tables
I wrote some extension methods to read CSV-styled text directly into a datatable or dataset or write them to this format. Is it right to use the methods as extensions or should I create a separate ...
3
votes
3
answers
3k
views
CR2 raw image file parser in Python 3
I haven't used Python in a number of years, but recently started working on a project called Photoshell which is written in Python 3.
As I attempted to learn the "Pythonic way", I wrote a parser for ...
7
votes
1
answer
799
views
Save Games on iOS with NSCoding
This is the second time I have implemented saving and loading for a game using Objective-C. I am using the built in NSCoding methods. I would love to hear opinions about NSCoding and whether or not ...
10
votes
2
answers
3k
views
Intranet PHP application
I'm more of an IT guy (no CS course) with a strong and passionate relationship with Unix and I love KISS.
I'm writing an application to help my coworkers with their daily tasks. Every now and then I ...
5
votes
1
answer
177
views
Creating a Ruby gem that talks to another gem
I am working on creating an interface gem that works with the Jira-Ruby gem.
I have several questions and would like a general review for both my code and my attempt at creating a gem (I've never ...
5
votes
2
answers
175k
views
Reading a line from a text file and splitting its contents
I have this kind of file structure
MALE:FooBar:32
FEMALE:BarFoo:23
Where I would want to identify the gender and age of person, ...
2
votes
3
answers
152
views
Replace first occurrence of pattern in file
Here's my attempt to replace first occurrence of pattern in file with spaces. Effectively deleting it, and hopefully will allow me to "delete" it in a large file, ...
1
vote
1
answer
195
views
Iterating through 128-byte records in a file
I need to read records from a flat file, where each 128 bytes constitutes a logical record. The calling module of this below reader does just the following.
...