Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

3
votes
1answer
62 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
0answers
32 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
36 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
58 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
80 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
32 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
65 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
41 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
26 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
60 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
71 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
24 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
50 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
67 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
75 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
74 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
91 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
38 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
24 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
56 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
93 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
61 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
58 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
62 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
73 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
0answers
116 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 ...
0
votes
2answers
54 views

Search files content fast in powershell

I need to search a large repository of files for a specific resource, and return it only if it is used or not. It is working as expected, but it is very time consuming. To search for 50 resource ...
2
votes
1answer
54 views

Bash on Synology - Delete recycle bin entries over X days old

Synology NASs have a Task Scheduler that allows you to schedule deletion of files over X days old from recycle bins. This feature isn't working for me–running the task results in no files being ...
2
votes
1answer
45 views

Python script that alerts me when specific file gets created

I wrote a small script that opens a window using PyQt when a specific file gets created. This is to let me know when another program (that I have no control over) has finished calculating something. ...
0
votes
0answers
24 views

Using Python to list recent files in directory

I'm working with directory of raw data .csv files, stored daily in a directory with the same name except date stamp in the name, for example ...
3
votes
1answer
17 views

Tagging the directories and switching between them by tags - follow-up (Part 2/2: business logic)

This is the bash script responsible for changing the directories via textual tags. (See here the entire project.) dt_script ...
1
vote
1answer
32 views

Tagging the directories and switching between them by tags - follow-up (Part 1/2: File management)

This is a rework of a small program for faster(?) switching working directories, and it looks like a pile of crap, I must admit. Could you give me pointers how to make it maintainable? dt_tag_entry....
1
vote
0answers
31 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 ...
2
votes
1answer
25 views

C Recursive Opendir Wrapper to Sort Directories First (ascending/descending)

A recent post on StackOverflow about a recursive directory listing which produced an unsorted mixed file/directory list, sparked the stray thought of "What would it take to write a wrapper for the ...
4
votes
1answer
302 views

Simple directory monitoring and processing file on appearance

Currently I am working on some kind of mechanism which will be able to monitor directory and when file with extension .pdf appears I need to mock some kind of ...
6
votes
1answer
99 views

Identify Duplicate Files

A friend of mine has the following issue. He has a nearly-full 1TB hard drive on which he keeps copies of all the pictures from his digital camera(s). However, he knows that he has copied the entire ...
2
votes
1answer
108 views

Making a catalog of pictures

Is there a way to make this code run faster? I have over 6000 pictures in .jpg optimized to a maximum of 40 kB. It starts quickly but after like 2000 pictures it runs way slower. The final .xlsm file ...
0
votes
0answers
22 views

Filtering files and directories

I want to filter directories and files by what they start with. ...
5
votes
1answer
41 views

Scheduled file sorting with Ruby

I have a script running as an hourly cron job. It finds all screenshots on the Desktop and moves them to directories sorted by year/month/day. On MacOS, screenshots are automatically saved to the ...
2
votes
3answers
86 views

Renaming all files/folders in first children folders but not sub-children

Let's say I have this folder tree: ...
3
votes
1answer
453 views

Writing to a file in Golang across concurrent go routines

I've been reading around how golang writes to a file, and this stack overflow question and this reddit question highlights the fact Go doesn't gurantee atomicity when writing to a file system. ...
2
votes
0answers
25 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 ...
4
votes
2answers
99 views

Renumbering files in a folder consecutively

I wrote a program to rename files with consecutive numbers, basically removing the gaps in the numbering. This could be a very annoying task to do it manually in windows. I only did this for ...
5
votes
1answer
49 views

Find big files on the harddrive

For practicing Python I wrote a script which scans the harddrive for large files and lists them in a report. The script takes the root path and then all the subfolders are scanned aswell. Also the ...
1
vote
1answer
44 views

List directories, subdirectories and files, while ignoring some dirs

In my application, the user may or may not want to ignore some directories. I can do that, but it seems like I am repeating myself. Does anyone have an idea to refactor that? ...
8
votes
3answers
251 views

Multiple file access abstractions

When using dependency injection for nearly everything it's good to have some file access abstraction. I find the idea of ASP.NET Core FileProvider nice but not sufficient for my needs so inspired by ...
3
votes
2answers
53 views

Special FileLogger: write-all after 100 logs or before 1 second without new log

My question is about an easy FileLogger. I want the FileLoggers to store new logs in a collection, and write them in a file only if: - There are 100 logs if the collection - It's been more than 1 ...
2
votes
1answer
54 views

Unit tests for directory-entry counter

I have a function that simply counts the number of files in a directory. To test this function I am using temporary files which are great in the respect that they are deleted upon creating. However, ...