Questions tagged [file-system]

Use this tag for reviews of code that performs file system operations, such as creating, deleting, renaming, moving, copying, reading, and writing files.

Filter by
Sorted by
Tagged with
3
votes
1answer
34 views

This program reads from serial port, Saves this to a text file, increments file name each time it is run

I want to condense it and get rid of any noob programming errors. The code works fine but I know it's not as elegant as it could be and I really want to improve. Your advice would be brilliant! I've ...
5
votes
1answer
73 views

Plain-text file encryption and decryption

I have created an Encryption and Decryption Algorithm that encrypts plain text using a given cipher and also decrypts it back to the original notation. It works great. This was my code for a coding ...
-5
votes
0answers
22 views

delete a file using by another process in c# [closed]

I want to delete a jpg file from my C# program but I can't do that because these files are in use by another process. I tried different things but none worked. Does anyone have a solution? This is my ...
1
vote
0answers
14 views

List files and folders in current dir with special handling for tty

I want to write a custom ls command to learn rust. This is what I've done as for the version 1.0. This display files and folders in a cyan or white if it's on a ...
8
votes
4answers
399 views

DDD Architecture for an e-commerce website (uploading images)

Problem Description I am working on an e-commerce website, when a user wants to sell a product, he would open the product page and he can upload up to 12 photos: Image Upload Process This is the ...
2
votes
3answers
49 views

Write directory new entries to file periodically, keeping the ones that existed in the past

Some backup Bash script on my machine copies a specific directory entries filenames into a text file. Entries that no longer exist have to be kept (entries added during a previous run). The script ...
1
vote
0answers
35 views

Photo rename by Exif date and group into folders with a threshold

I wrote this tiny F# project yesterday, but I am a bit rusty and I would like to know if there is anything I can refactor and make more elegant. ...
5
votes
1answer
54 views

Interactive folder files organizer (Alpha-numeric and type) for macOS / Linux in Python

A simple interactive Python script for organizing messy folders on the computer, supports macOS and linux but not windows. The mini-program has the following features: Creation of Alpha-numeric (A-Z /...
2
votes
1answer
76 views

Go functions to create a directory if it doesn't exist

Which of the 2 solutions is written better? Personally I prefer the one line method but it does make it slightly more difficult to debug. Is perhaps doing it the long way first then refactoring to ...
3
votes
0answers
35 views

Adapter pattern to support multiple file storage systems

I am just getting in to following design patterns. I have create a class that allows for performing a couple operations on different remote storage systems: drive, dropbox, .etc (I call these ...
2
votes
0answers
34 views

Implementing an efficient async FileSystem class based on libuv in C++

I currently am working on a game engine written in C++ with libuv backed for io system calls. I have a FileSystem class that just 'works'. I am allow to read files without blocking but the current ...
2
votes
0answers
33 views

Bulk File Rename; Improved Safety and Performance

A function that funnels all filenames into a file and opens that file in vim. The user then changes the names, saves, and quits. Finally the function renames the files in the folder with the new names ...
6
votes
1answer
121 views

Delete all virus-affected files with certain filenames

Purpose of the code is to delete all virus affected files from your pc. ...
2
votes
0answers
54 views

Minimal Static Site generator

For my first project with Rust, I decided to try and implement a minimal static site generator. I've never had any code review, and I've been looking for some feedback so I can get better! Brief ...
2
votes
2answers
63 views

Reading image files asynchronously and displaying them on the page

I am trying to display images from a folder in my project using the "fs" module with NodeJS. I need to read all images in a directory and run them in a loop for them to be displayed. I was able to do ...
13
votes
1answer
76 views

Loading a file from a FAT32 filesystem in 16 bit real mode on x86 (Intel syntax assembly)

I am writing a bootloader that needs to load a file from a FAT32 filesytem. Since I need to load both the root directory first to find the start of the file, and then the actual file, I wrote a ...
3
votes
0answers
37 views

SHA256 directory hash

I'm pretty new and I posted on SO earlier because I wanted to make sure my code was right and all that and I got redirected here. So I have this code that I put together (using Example C Program: ...
5
votes
1answer
103 views

Python script to rename images based on descriptions in a text file

I like to collect images for my desktop background, but the problem is sometimes the image names don't represent what the image is. I decided to write a script that reads a text file that contains the ...
2
votes
1answer
34 views

Creating a file of md5 hashes for all files in a directory in PowerShell

I have been trying to write the md5 hashes for all files in a directory and its subdirectories to a file. Ideally, replicating the output of the Unix command ...
3
votes
3answers
945 views

Go function to test whether a file exists [closed]

How could one write in a more elegant way that if error is null, the result is true? I really need a bool as returned value. ...
5
votes
2answers
59 views

File duplicate finder

In an attempt to clean out my picture collection I made a script to find all duplicate files ...
10
votes
2answers
148 views

Files manager API in C++

I wrote a file manager API in C++ to make the read-write operations easier in read/write cases, needing big structured data to/from multiple files. I want to get a review of the library if it's ...
5
votes
2answers
86 views

Program to delete directories that do not contain a file

I'm an intern and have an ETL project I'm doing in python. Part of it is to make sure after I move files I delete empty directories. I wrote this code to clean up directories that are empty and in ...
5
votes
1answer
89 views

EEPROM-based filesystem, aiming for Misra C++ 2008 compliance

I'm writing code for embedded systems (IAR compiler) and it should adhere to Misra C++ 2008. This limits the available features of the language quite a bit: no C++1x features use of the standard ...
3
votes
1answer
77 views

Deduping files using hardlinks

I'm trying to organize my gallery, and I have certain folders rife with copies. My daily work is mostly javascript and php, being your generic web developer. However I took this as an opportunity to ...
4
votes
0answers
52 views

Sandbox file system for Java

I've recently started work on a hobby project that's basically a sandbox file system written in Java, slightly inspired by PhysicsFS. The point of the project is to separate what files a user can read/...
3
votes
1answer
84 views

Most efficient way to loop through files using VBA Excel

I have a procedure for looping through all files in folders and subfolders starting at a folder which the user can select. The user can select both the source and target folder. I'm using Excel VBA ...
6
votes
1answer
82 views

Python script to clean out old files from a repository

I wrote the script below as my first python program that will be running in a production environment. Essentially this program looks at a source location and moves all the files to a destination ...
2
votes
0answers
52 views

File-system based queue in python

I would like to implement a concurrent (multi-thread, multi-process) queue that is backed by file system. Data is pickled over a file, stored in a directory and given a sequential name. The ...
4
votes
2answers
69 views

Static site generator using JavaScript Promises

I have created a small static site generator (for learning purposes) in Javascript ES6, using Promises, but I am not certain of how to use them well. The code below works fine, but I wonder if i can't ...
4
votes
1answer
44 views

Find filenames with 4 digits which are not divisible by 20 and delete them

I have a set of files in folder my_dir, which is not the folder where my Python script resides. Sample content of my_dir: ...
4
votes
0answers
32 views

Combining CSV files of simulation results

This script is a subset of a larger script where I have the output of many test simulations in the form of CSVs. Each file starts with the model name and includes the number of elements in my file. ...
7
votes
1answer
70 views

Finding duplicate files on a disk using MD5

I started learning Python a month ago (used to write programs in Delphi before). Can you please take a look at my code and give me some tips what is good and what is bad in it? The aim is to find ...
1
vote
1answer
83 views

Writing billions of lines to text file in java [closed]

I'm trying to write billions of strings lines to a file, it works for up to 40 million lines, but it's throwing out "java.nio.BufferOverflowException" error for 400 million lines. I also think my ...
2
votes
0answers
26 views

Printing files count and size of a directory tree

I've written a small package that counts the files and the size by file type in a directory tree. It produces the result as a markdown file. Here is a sample: ...
2
votes
1answer
53 views

Backup program in Python3 for Linux

Python beginner here. Created this program as a project to help learn python. Just ran this in a centos7vm so far to test. What it does is - zip up files containing certain extensions (excluding those ...
1
vote
1answer
79 views

PHP class for scanning filesystem

I have a modelScan.php file, as you can see, I have codes that repeated within the function/method. How can I make this code more readable? ...
1
vote
1answer
83 views

Program that deletes near duplicate directories and directories that have .ini like files

The program needs to only keep directories that have at least 1 .osu (.ini like) file with certain restrictions in them. It also needs to delete duplicate .osu files. But since duplicate files are ...
4
votes
2answers
75 views

Comparing each item from dir with each item from another dir

The task is to compare students homework SQL files with mentors SQL files. I've written two functions, which return a two-dimensional array (1st elements are an absolute path, 2nd are a relative). ...
5
votes
1answer
93 views

Find png files in folder structure and map them to Photoshop groups and layers

I've created a heavily problematic code that works. Summary: It looks through a folder structure, for png files and tries to replicate this structure in Photoshop. Files are mapped layers and Folders ...
0
votes
1answer
40 views

Delete directory tree function

I made this function to delete a directory with all its contents recursively, will it work as expected in a production environment ? is it safe ? I don't want to wake up one day with ...
1
vote
0answers
26 views

Average histogram combining multiple files and vector of vectors (in c++)

I run a program of simulation N times (I use each time a different random numbers to initialize it). The results of the program are stored in 2N directories: every run produces two approximations. The ...
0
votes
1answer
94 views

LINQ or Lambda for two foreach query [closed]

I have a Document Name Table in my SQL database and Files in the Content folder. I have two lists: ListOfFileNamesSavedInTheDB and ...
4
votes
2answers
265 views

Best way to retrieve music metadata from audio files?

I am using the music metadata-browser npm package to retrieve audio metadata from files. This library is being used in an Electron and React desktop app. To get the metadata of audio files, (and add ...
1
vote
0answers
89 views

Implementing std::filesystem::remove_all() for Android

I needed to use some c++ code on both standard Linux and the Android variant, and the code will use filesystem library but it isn't yet in the ndk. So I'm making a one to use on Android It will be ...
4
votes
1answer
73 views

Powershell script for zipping up old files

I have a script for zipping up old files. I know using Windows Compression isn't ideal, so I will make the script run using 7-Zip later on. For now though, I just want see how I can make my current ...
4
votes
1answer
66 views

Copy files from directory to SSH Server

The overall idea is: I have an Android phone and I would like to copy the files in a folder from the phone (which is running an SSH server, that's how I connect to it) to a harddrive connected to my ...
2
votes
2answers
76 views

Writing a ~100Kb HTML string over an MD file (number of iterations ~10K)

I have tried to write a large string (~100-120 Kb of HTML) on an md file, and am pretty sure it's not the fastest method, even though it only has to iterate ~8000-...
6
votes
2answers
1k views

Backup with Hanoi Strategy

I want your suggestions about this shell script. I use it to backup some configurations on my home media server. What improvements would you do? Keep in mind, I want to optimize space and speed and ...
7
votes
1answer
183 views

Python code to identify structure of a text file

We have a department in our org that generates a lot of data in flat files, all with different formats. We are now trying to sort this data out and load into a database. As step 1, I am trying to ...