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
1 answer
50 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
17 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
42 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
71 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
177 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
  • 117
3 votes
2 answers
41 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
59 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
49 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
51 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
55 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
126 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
61 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
110 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
44 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
94 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
39 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
48 views

Create a folder with subfolders and files from a R dataframe

I have such a dataframe: ...
user avatar
4 votes
2 answers
107 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
  • 25.7k
2 votes
1 answer
76 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
2k 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
305 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
150 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
94 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
69 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
55 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
69 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
520 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
91 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
109 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
154 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
196 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
92 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
76 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
87 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
24 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,556
2 votes
2 answers
63 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
122 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
53 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
7 votes
2 answers
2k views

C delete files and directories, recursively if directory

This is my function that uses recursion to recursively delete a directory. I like my way of skipping entries . and ... But ...
user avatar
2 votes
3 answers
111 views

A file system watcher class for on-fly file reloading when it has been modified

I wrote a file sytem watcher class that is used to monitor file modification and then execute user-defined handler. Other file system events like moving or deleting don't need to be monitored. The ...
user avatar
  • 385
5 votes
2 answers
67 views

Count *.plot files in certain directories on network filesystems

First of all, I am playing around with python for about a week tops. Absolute beginner here. My story: I work as an IT administrator so I am familiar with eg. PS on a very basic level. I actually got ...
user avatar
  • 51
1 vote
3 answers
166 views

Basic Linux filesystem commands

I'm learning the file system library and thought nothing could be better than a project, so I thought of recreating the basic Linux commands such as ls, ...
user avatar
  • 33
4 votes
2 answers
182 views

Efficiently write in a file in C++

I've made a program which reads from the console and writes it in a .txt file. This programm should write in a file with \n. <...
user avatar
  • 85
1 vote
0 answers
28 views

Powershell Refolder by Filename Before Delim

I'm pretty new to Powershell but have been using it more and more to automate tasks at work. Now I'm reaching out for some help. I typically use the scripts I write in a way where I copy and paste the ...
user avatar
0 votes
1 answer
658 views

Retrieve filename and ID with Google Drive API in C#

I am trying to retrieve filename and ID list with Google Drive API (the latest Drive API version v3 is used here) as a first step in order to analyze and manipulate these files on Google Drive. The ...
user avatar
  • 3,556
2 votes
1 answer
29 views

C code to reset all usb devices (because ubuntu laptop disables usb mouse after sleep)

I don't program much in c, but cobbled together some code from different places in google. I'm sure this is backwards especially in how it works with strings and directory files. Please let me know ...
user avatar
  • 23
3 votes
0 answers
47 views

Python script that getting list of all files with specific ext starting from the current folder. Using timer for reporting about the process

I am using a function that returns a list of all files (full path for each of them) with the given extension in the given folder and all subfolders. As the process is quite long and user can get ...
user avatar
  • 31
2 votes
1 answer
269 views

Traverse directory using multithreading

I have written program which following purpose Traverse directory in multi threading environment First determine all top level directory and store into vector which have following result: /home/dir1 ...
user avatar
3 votes
0 answers
21 views

Detecting Dependencies in Common Lisp Project Files (Part 2)

This is a rewrite of the Dependencies program submitted previously at https://codereview.stackexchange.com/questions/255635/detecting-dependencies-in-common-lisp-project-files/256336?noredirect=1#...
user avatar
  • 405

1
2 3 4 5
14