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.

59 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
0answers
293 views

Copying folder contents from several folders

I have a file directory which contains folders for every month, and within those folders are several text files. In this context I would like to copy all of the text files from my ...
4
votes
0answers
38 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. ...
4
votes
0answers
303 views

Generate NDVI Rasters from USGS EarthExplorer Landsat 8

I've written the following using Python Dictionaries and Pathlib Module. I'd like to improve the first function: list_landsat_bands. I've created a list of file patterns to match, which I then use ...
4
votes
0answers
207 views

In-memory file system context for the behat PHP BDD testing framework

I wanted to come up with a 'utility' context to enable testing of the file system with behat. Specifically this is aimed at helping with the behavioral testing of php command line applications that ...
4
votes
0answers
2k views

Python files sync

I'm trying to do a one-way directory sync. Given a list of existing files in a dir, I'd like to make the files in the dir equal a new list of files. There will be subdirs under the dir. Because ...
4
votes
1answer
94 views

File read/write methods

I'm using some simple files for caching and some basic user data. I was first just using file_put_contens and file_get_contents, ...
3
votes
0answers
58 views

C program to sort files based on information within

I have written a C program to sort files (on Windows) into dynamically created subfolders based on information found in their data headers. I am a newb at C, especially memory management. The code ...
3
votes
0answers
43 views

Caching image thumbnail web-application based on rocket

This is my first rocket web-app. It serves images from a directory and thumbnails from a sub-directory. if no thumbnail is found for an existing image it is created on the fly. Before I launch this ...
3
votes
0answers
38 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 ...
3
votes
0answers
63 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: ...
3
votes
0answers
83 views

Print a list of disk blocks used by file(s) - Linux

This code takes a list of filenames as arguments or from stdin (or from a provided file) and dumps a list of disk blocks used by those files. An attempt is made to use the linux ...
3
votes
0answers
147 views

Follow-up: Script to create symlinks for dotfiles in a Git repository

This is a follow up to my previous question on Code Review. I did try to implement most of feedback provided by thiagoalessio. This is what my updated code looks like: ...
3
votes
0answers
35 views

Rewriting the GnuWin32 Touch Command with the Win32 API

There are essentially two options for Windows users accustomed to the *nix command-line functionality; you have to either download a framework like Cygwin/Msys or use the GnuWin32 packages (of which I ...
3
votes
0answers
823 views

Compressed static file serving in flask

Flask comes with built-in static file serving, but compression support is completely missing. I think the way whitenoise implements it and compress files during builds. The following should serve the ...
3
votes
0answers
526 views

Recursively list files in provided directory in the style of `npm ls`

I've written a small CLI node program to list the contents of a directory with an output similar to that provided by npm ls but listing both files and directories, ...
3
votes
0answers
2k views

Automatically redirect /index.php files to their URL directory with .htaccess

The requirements: Work inside .htaccess (preferably via mod_rewrite) Redirect requests from /any/directory/index.php to ...
2
votes
0answers
82 views

downloading a list of urls

I wrote this quick (lots of googling) and dirty (I hope not too dirty) script to download a URL list with a win32 wget port and save them as files with the url as the name to use as a "poor man's url ...
2
votes
0answers
57 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
35 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 ...
2
votes
0answers
61 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
0answers
207 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 ...
2
votes
0answers
28 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
0answers
27 views

Script to report disk usage

I am trying to see how I can speed up the below script that reports disk usage. The timed find command towards the end is the problematic line that I am trying to ...
2
votes
0answers
57 views

Attempt to save (recover) files from a broken external drive

My external drive that I use for Backup had some broken files. I feared that I'd lose some (or all) the data in there. So I wanted to copy each and every file to my hard disk. I first tried using ...
2
votes
0answers
44 views

Class to construct paths based on the path to the current class file

I have written a class that locates relative root project directory path from where I'm calling that class. E.g. I have structure: ...
2
votes
0answers
651 views

File shredding (secure deletion) algorithm

Does anyone see anything wrong with this? I was considering using something like srm or wipe and use ...
2
votes
0answers
169 views

Syncing NTFS permissions with SMB share permissions

I recently wrote scripts to automate the setup of shares on a server using the New-SmbShare cmdlet. I hadn't realised that this cmdlet doesn't automatically amend ...
2
votes
0answers
602 views

C# FileSystemWatcher Manager with Debounce

For a class last fall I was working on a "cloud backup" system. Originally in Pascal, I decided to rewrite it in C# and expand the feature set. Below is the FileSystemWatcher "manager" class which ...
2
votes
0answers
463 views

Get process max memory usage while copying large data

I want to check the memory usage of a process before and after I copy a large file or folder, and also, I want to get the maximum memory usage during file operation. Is this a good method? ...
2
votes
0answers
52 views

Concurrently identify duplicate files from size ordered list

Following on from my program to identify files that have common file sizes, I have developed an application that takes the output from that process and then compares each of the files that are the ...
2
votes
0answers
150 views

Frequency of words in all files of a directory using Future - Scala

I created a program to get frequency of word in all files in a directory using Future API ...
2
votes
0answers
277 views

PHP upload class

I know there are many PHP upload classes out there, but I'm comfortable with my own code, so I made a simple one here. What do you think of my approach when isImage...
1
vote
2answers
34 views

What is the fastest way to record the names of each file in a directory?

I want to fill an array of strings with the name of each directory item. The issue is allocating memory. I either need to count the items before, allocate memory, then go over them again, or I will ...
1
vote
0answers
37 views

File organizer based on extensions

I'm still new to programming and I'm not confident about this code. I recently created this File Organizer that organizes files in folders based on their extensions. How can I make this code cleaner? ...
1
vote
0answers
70 views

Implementing A File and Directory Traversal Iterator in Rust

Background Traversing the file hierarchy, going through files and sub-directories from a directory, is a quite common task when doing file system search operations of some sorts. I have already ...
1
vote
0answers
46 views

Recursively look up directories, (a little bit) slow

I wrote some Java code to look up all files in a chosen directory (like it's showing in the Windows Explorer), and to display the results, but it seems to be slow. Can you tell me, how to speed up it? ...
1
vote
0answers
37 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. ...
1
vote
0answers
31 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 ...
1
vote
0answers
138 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 ...
1
vote
0answers
42 views

Python script to add unittest decorators to source code files

This is a simple Python script to add @unittest.skipUnless() decorators in a specified format above every function starting with ...
1
vote
0answers
45 views

Java Multipart text file analysis to zip

So I am working on a project that should take .txt file as an input and analyze words in it (assuming all words are English). Program must run asynchronously. Final output should be multiple .txt ...
1
vote
0answers
50 views

Move image files according to watermark identified by a neural networks

I have created a neural network that can identify watermarks and can classify them to which company do they belong. Now I created a script that will identify watermark from a folder and move them to ...
1
vote
0answers
862 views

XignCode Bypasser installer for Blade & Soul

As the title says, this batch script installs the XignCode Bypasser. Xigncode is a software bundled with games to analise running programs and prevent cheating. (Sometimes, it prevents the game to ...
1
vote
0answers
69 views

Async function to write products to file

I'm currently trying to learn how to use await/async functions. Could anyone offer any thoughts on how to improve this function which uses await inside a for loop? ...
1
vote
0answers
40 views

Copy data for a list of stocks from all Excel files in a directory

I'm trying to do the following things. ThisWorkbook has list of stocks. By using for loop i'll select each cell. Number of rows in this sheet are 215. Create a new workbook with the name as above ...
1
vote
0answers
295 views

List all files matched by glob within JSON file

Based on a set of globs contained in a custom field within a package.json file, I'm trying to get a list of all the files that the glob matches. In my continual quest to get more familiar with ...
1
vote
0answers
158 views

Class for managing (file I/O) data

I want to make an attempt to write my own simple RPG. As a preparation for this task I created a class which I could use to store/retrieve my in-game objects data to/from disc. I chose JSON format as ...
1
vote
0answers
411 views

RSYNC Style Mirror Folder Application

I've written a mirror folder application in C#. It uses CommandLine for command line parsing. I'm just looking for a general review. ...
1
vote
0answers
53 views

Event log implementation with TDD

Below is some code that implements an 'event log' whose purpose is to record events and periodically check that all events were recorded in chronological order. The collection of events must be ...
1
vote
0answers
526 views

Tab completion for custom shell

The purpose of the code is to enable tab completion for a custom shell I'm writing. The target OSes are Linux and OpenBSD. I had to make a conditional include that I hope is correct: ...