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
4 votes
2 answers
205 views

Attempting an OOP approach for PDF Paranoia - Automate the Boring Stuff CH 15

This exercise is called PDF Paranoia and it comes from CH 15 of the book Automate the Boring Stuff With Python - second edition. There are two parts to the exercise, which I've separated into two ...
user avatar
  • 159
1 vote
1 answer
106 views

File Abstraction Library

This library is a layer of abstraction over file operations in C#. It aims to provide easy file IO syntax, and implicit error handling behaviors, to ensure robustness in scenarios including, but not ...
user avatar
  • 13
2 votes
2 answers
61 views

Finding files using multiple coroutines

I'm trying to write a simple program to find a certain file name within a directory tree. I use up to 30 coroutines. Is there anything wrong with this code or what needs to be improved? ...
user avatar
3 votes
1 answer
84 views

Faster way to find duplicates in a directory using Python

This is my first Python project in file management. It's a finished and passed exercise from JetBrains (Duplicate File Handler). The main job is reading a full path to folder from argument, list files ...
user avatar
  • 33
0 votes
0 answers
35 views

Filter duplicate events raised by FileSystemWatcher

As you know about FileSystemWatcher Events, which may fired twice or more according to OS handling, For example creating a .txt file may fires two events (1)For ...
user avatar
  • 1
0 votes
0 answers
22 views

A Clojure program to classify files based on their filename

My first ever lines of Clojure and while the script seems to work as expected, I'm sure it's far from idiomatic Clojure. Thank you for any suggestions. ...
user avatar
4 votes
2 answers
140 views

Python script for removing files in folders

I've been learning python for some time and I've come up with the idea to practice it a little. I created a script that removes files by their extension .html and .srt and also empty directories. It ...
user avatar
4 votes
0 answers
83 views

Determine when a file is no longer being changed by hashing

I have a requirement to essentially scan a filesystem on any kind of filesystem and move a resource whenever it is ready. To do this I have the following code ...
user avatar
4 votes
1 answer
41 views

Mount point API for Linux systems

I have a use case where I need to check, whether / is mounted read-only. Here's the module where I implemented this check: ...
user avatar
0 votes
0 answers
19 views

Constructor for a python class, receiving input from user or file, which happens to be for a Sudoku solver

There are quite a lot of Python Sudoku solvers on this site, but my question is more about style , structure, design and (if I can coin a phrase) Pythonicity (ie is it Pythonic) rather than ...
user avatar
0 votes
1 answer
70 views

I have written a method to write any string in file. Should I close file or not

I have written this code to write string to file. If File is not created then create file and If created append to same file. File is created daywise. ...
user avatar
3 votes
1 answer
52 views

Open a file, by looking in an ordered list of directories (search path)

I have a small Python application that needs to load a few different files (templates and config files). It should look in a number of destinations, in the following order, and load the file from the ...
user avatar
2 votes
0 answers
21 views

Rust Undertale Save File Loader

This code's job is to load save files from a subfolder in ~/undertale-saves and save them to ~/.config/UNDERTALE_linux_steamver. ...
user avatar
2 votes
1 answer
44 views

Changing the attributes of a file

I wrote a program that changes the attributes of a file. How can I make the program more efficient? Please find program problems. How can I improve the program? ...
user avatar
  • 51
1 vote
1 answer
80 views

Thread in a Spring app that watches a directory for new files

Before showing-off the code, here is a bit of an explanation. I have a Spring component that spawns a thread for watching a directory for new files. In this context, I have a method that runs in a ...
user avatar
3 votes
1 answer
205 views

Automate the Boring Stuff CH 10 - filling in the gaps

This exercise comes from Automate the Boring Stuff CH 10 - second edition. The exercise is called "filling in the gaps," and the instructions are as follows: Write a program that finds all ...
user avatar
  • 159
3 votes
2 answers
43 views

Single-file stdlib-only python backup utility

I have written this backup utility to keep incremental backups by copying new and modified files, and hard linking unchanged or simply moved files. In an attempt to speed up the comparisons, I save a ...
user avatar
  • 233
3 votes
2 answers
62 views

change file attributes on a Linux file system with chattr

I am reading the book The Linux Programming Interface and I have reached the exercise in which the implementation of the chattr command in C is required. I would ...
user avatar
  • 51
2 votes
1 answer
51 views

UPDATE #1: Lengthening the time it takes to access files using function hooking

https://github.com/speedrun-program/load_extender This is the previous post: Lengthening the time it takes to access files using function hooking I tried adding everything from the previous post's ...
user avatar
3 votes
0 answers
58 views

Organize files based on inputted keyword

My code basically organizes the files in a given directory based on the keyword inputted by the user, so for example if there is a directory with three files: ...
user avatar
2 votes
1 answer
57 views

Lengthening the time it takes to access files using function hooking

https://github.com/speedrun-program/load_extender This is something I made and posted here about a year ago, but I decided to remake it. To compile this on Windows, you need to install EasyHook. ...
user avatar
4 votes
2 answers
139 views

Recursive function designed to ensure that full folder path exists before copying a file to the location

My recursive function works, but I feel it could be improved... suggestions? The code ensures that a given folder path exists by checking its validity or creating them if they don't already exist, so ...
user avatar
  • 181
1 vote
1 answer
64 views

Get files from disk filtering by size

does anyone knows how I can simplify this code? The objective is to get multiple files from the explorer and validate the number of files, the weight of each file and the total weight. ...
user avatar
2 votes
1 answer
113 views

implementation of the `mkdir` command with `-p` parameter in C

I wrote a program that implements the mkdir command with the -p parameter to create the parent directly if it does not exist. My ...
user avatar
  • 449
2 votes
1 answer
49 views

Safely renaming/moving files in Node (cross platform)

My goal is to create a function that safely renames files by adding numeric increments if the file is found at the destination, without using a third party library. Having a source file ...
user avatar
1 vote
1 answer
96 views

Open, read/write, then close a relative path

These functions will open a relative path, read or write to the file, then close. The purpose of these functions is to avoid duplicate code patters for accessing different files that only require one ...
user avatar
1 vote
1 answer
43 views

PHP autoloader that uses array of file paths

After doing much reading of the PHP docs and trying out other developers' autoloader code, below is what I've come up with for an autoloader. It is working as expected so far. Posting the code here ...
user avatar
  • 335
2 votes
1 answer
72 views

Create a folder with subfolders and files from a R dataframe

I have such a dataframe: ...
user avatar
4 votes
2 answers
113 views

ds - directory switcher - a *nix command line utility for tagging the directories and switching between them via tags (Perl + bash)

I have this program for tagging directories and switching between the folders via tags. The front end is written in Bash (version 4.4.23) and the back end in Perl (5.26.1). Critique request Since this ...
user avatar
  • 26k
2 votes
1 answer
83 views

program that implements the `mkdir` command

I wrote a program that creates a directory, similar to the mkdir command. My question is, is this implementation correct? What else could I improve or what problems ...
user avatar
  • 449
16 votes
6 answers
3k views

A file class for Python

This is the entire code segment. All the functions for file operations are working perfectly. I just need a professional to help me clarify that am following good standards, documentation, etc., ...
user avatar
7 votes
1 answer
306 views

Program that checks if two files match. Is this implementation the most appropriate?

I wrote a program that checks if two files (with a different path / name) match or not. The hard and symbolic links between the files are followed to determine it. I know this is not the best ...
user avatar
  • 449
2 votes
2 answers
153 views

Get the total file size from a directory for each date using map and pairs

I'm working on a project where the file name consists of actual dates but the data for the dates are split into multiple files. Developed the following program to count the number of files for each ...
user avatar
  • 163
3 votes
2 answers
97 views

Is this implementation of the `mv` command the most appropriate? It can be improved?

I wrote a program that implements the same function as the mv command. I know this is not the best implementation, so I would like some suggestions for improvement, ...
user avatar
  • 449
0 votes
2 answers
71 views

Copying a folder to another disk in python

I have made this code to copy a folder to another disk, and it works, but I think there is a better way. If don't use the replace(), it says the folder exists and ...
user avatar
  • 49
1 vote
1 answer
56 views

Recursively delete directory using relative filesystem calls

I made this function to recursively delete a directory and its contents, because using VLAs to concatenate paths is more susceptible to Stack Overflow and is probably slower. ...
user avatar
0 votes
1 answer
74 views

Extract matrices from hierarchical file structure

I have a set of JSON files stored in a folder; the folder structure is as follows: Main_folder ----F1 -----I1 ------X.json -----I2 -------X.json . . . . . . In all,...
user avatar
5 votes
1 answer
679 views

C# Async FileInfo Extensions (Copy, Move, Delete)

Here is my effort to implement extensions for FileInfo object: ...
user avatar
  • 151
2 votes
1 answer
127 views

Read file from current path in Python

I had to write a custom function to load a yaml file from the current working directory. The function itself works and my intention was to write it in a pure fashion but my senior colleague told me ...
user avatar
  • 123
1 vote
2 answers
112 views

Moving files according to paths in database

I'm trying to move a large number of files. I get the path of source and destination from database. It takes hours to move images, and I was wondering if there is a faster way for moving large ...
user avatar
4 votes
1 answer
173 views

Code to scan filesystem, store every path into sqlite and update only when something has changed

I have made a program that does what the title explains. It also hashes the file to check for changes. I will be doing this for a project to keep track of files that has been changed when doing ...
user avatar
5 votes
1 answer
206 views

Optimized way to save list of files

I would like to optimize the way that I save files. Each second I save lots of strings in different files. What I want to do is bunch up these IO tasks so they happen in bursts, instead of spread out ...
user avatar
  • 103
0 votes
2 answers
100 views

Combining iterrows of pandas with os.walk given I have a lot of directories

I have the following code snippet: ...
user avatar
3 votes
1 answer
92 views

Delphi function to canonicalize the capitalization in a file path

I'm building a small Delphi application where a user can input a file or directory manually by typing it or by selecting it from a dialog . Since it can be input manually, I want to ensure that I save ...
user avatar
  • 141
0 votes
1 answer
90 views

Efficient way to construct list of sub-subdirectories in python

I have a directory that includes a number of subdirectories. Each subdirectories contains subdirectories of its own. I'd like to construct a list of all sub-subdirectories in python. Here is my ...
user avatar
  • 265
1 vote
1 answer
29 views

Batch generating histograms of images in Matlab

I am attempting to plot histograms for batch of images in Matlab. The file structure of input images and the experimental implementation are listed as below. File structure of input images The matlab ...
user avatar
  • 3,586
2 votes
2 answers
68 views

Send an array of files and return the first one that exists

I have a little project, chuy, which is basically a copy of Make. By request of users I have added support for toml configuration, since originally it only accepted ...
user avatar
4 votes
2 answers
1k views

CSV file reader

Hi, I asked this question over on stack overflow. However, they closed the thread and suggested to ask it on code review. So here I am :) The code below is an updated version of my original code, ...
user avatar
1 vote
1 answer
145 views

Replacing a char in the file name

I am formatting my TV series archive and can not do one by one. I wrote this code and it's working like what I want. I am a beginner and want to improve my knowledge of algorithm. What can you ...
user avatar
1 vote
1 answer
55 views

Move all markdown files from one folder to another in Python

I want to move all markdown (.md) files from one folder to another. The folder structure I have: ...
user avatar

1
2 3 4 5
14