Skip to main content

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
1 vote
1 answer
20 views

Implementing load and save operations for a text editor (proof of concept)

I have a text editor in C does not give much thought to losing data whilst overwriting the original file to save new progress. To circumvent this problem, and make the process robust, I ended up with ...
Harith's user avatar
  • 8,844
1 vote
1 answer
53 views

Clear the temp folder with Python script

I am addicted to cleaning the %temp% folder, so I went ahead and tried with pyautogui at first by making it click ...
Giannis Tsakas's user avatar
4 votes
2 answers
279 views

Simple size difference measuring tool

Simple tool I wrote in an hour or two (I'm not very fast, but I eventually get there - also for the "spending 6 hours to save 6 seconds" meme). Would've written this in shellscript given ...
404 Name Not Found's user avatar
8 votes
2 answers
823 views

Efficient file-copying utility using threads

The task is to implement simple 2 threaded "copy" tool. Tool should accept 2 parameters: source filename and target filename. Copying logic should be organized with help of 2 threads. First ...
rishi's user avatar
  • 181
6 votes
1 answer
399 views

Generate unique temporary file names in C++20

WARNING: do not use this solution See discussion in the accepted answer's comments. Basically, this solution would reproduce std::tmpnam's and ...
nilo's user avatar
  • 579
2 votes
1 answer
40 views

Finding the Size of a File in a Portable Manner (revision 2)

This is a follow up to Find the Size of a File in a Portable Manner (revision). Changes made: The return value of fseek() and ...
Harith's user avatar
  • 8,844
4 votes
2 answers
77 views

Find the Size of a File in a Portable Manner (revision)

This is a follow up to Find the Size of a File in a Portable Manner. What's new: The fast version (POSIX stat()) does not change the position indicator of the ...
Harith's user avatar
  • 8,844
4 votes
1 answer
176 views

Find the Size of a File in a Portable Manner

There's no function in the Standard C Library to determine the size of a file. The POSIX Standard has stat()/fstat() which are ...
Harith's user avatar
  • 8,844
12 votes
2 answers
1k views

Header-only log-structured database

I'm seeking a code review for the ~2000 lines of code. Makefile and tests are available at https://github.com/torrentg/logdb. I would appreciate feedback on the following aspects: Overall code ...
Gerard Torrent's user avatar
5 votes
1 answer
504 views

C++ - Find all duplicate files (follow-up)

What's changed since the first version: Instead of hashing each and every file, the sizes of the files are first compared, and if those are equal, the files are then hashed. A more collision resistant ...
Harith's user avatar
  • 8,844
3 votes
1 answer
303 views

C++ - Find all duplicate files

It requires no explanation, so here's the code. Code: ...
Harith's user avatar
  • 8,844
8 votes
4 answers
976 views

Remove all text files with non-US-ASCII text encoding from current folder on Linux

...
FAQ's user avatar
  • 183
9 votes
3 answers
302 views

Java code to delete all empty folders within a directory

Given the path to a filesystem directory, the task is to delete all empty directories within that root directory. After the process is finished, no empty dir should exist under the root directory (the ...
user avatar
5 votes
0 answers
190 views

Resolve an entire NTFS Master File Table's worth of File Records to Absolute Paths

This is related to my previous question. This is it, the full working code that resolves all file record segments in a Master File Table to absolute file paths. It is completely working and seems to ...
Ξένη Γήινος's user avatar
1 vote
1 answer
104 views

Looking for help simplifying a general purpose compression function

The following is a general purpose file compression function with the following features: It can take either a single file or directory as the source input It defaults to the source directory when to ...
Christian Fitzner's user avatar
2 votes
1 answer
231 views

NTFS Master File Table Parser

I have written a Python program to parse the Master File Table located by //?/X:/$MFT. Of course trying to open it normally will result in ...
Ξένη Γήινος's user avatar
3 votes
1 answer
47 views

Check if options are valid to create FAT12 image

This is a function that checks if a valid FAT12 image would be created. Since all the information to create it is available on the "boot sector", this is the parameter. I wanted the code to ...
Schilive's user avatar
  • 243
13 votes
5 answers
3k views

Portable old-school filesystem tool

I recently made a tool called mkfh to create a FHS compliant filesystem structure. I aimed to make it as portable as possible, so I wrote it in C89 and also tried ...
Labricecat's user avatar
5 votes
2 answers
378 views

Binary file reader and writer

I want to write a simple binary file reader and writer class. The class below can read or write file. main.cpp read 500 bytes from tmp.bin and copy at the end of ...
unique's user avatar
  • 153
1 vote
1 answer
281 views

Simple text file encryption and decryption

Short introduction; recently I've completed a basic course on C but other than that I have no programming experience and I am a total beginner. As a practice project and to practice reading from and ...
Reslashd's user avatar
4 votes
2 answers
385 views

Class for locking shared disk directory

I'm writing an application to sync files between two directories. In order to prevent simultaneous access to the shared directory from several computers, I implemented blocking of the shared directory....
Andrey Epifantsev's user avatar
2 votes
2 answers
198 views

Python script to categorize download folder based on files

My Download habit is notorious and my download folder end up piled up with random downloads, I created a python script to maintain my download folder in windows upon running the script it moves files ...
SHANTNU CHAUBEY's user avatar
5 votes
3 answers
796 views

Implementation of recursive `ls` utility

Recently I wrote my own implementation of a utility for recursive output of the directories' contents, kind of similar to the ls Linux utility with the ...
andylvua's user avatar
  • 215
1 vote
1 answer
697 views

Recursively create a TreeView for file paths using C# and WPF

I'm building a program that allows the user to monitor files on their local system. To display the files, I created a TreeView using ...
Ramza's user avatar
  • 171
6 votes
3 answers
149 views

Idiomatic and performant file hashing

I've written a small program that will accept a directory path and recursively calculate the MD5 hash of each file. ...
etchesketch's user avatar
6 votes
2 answers
231 views

ds - A directory switcher via tags in Windows command line

I have this repository. The idea is that there is a file tags sitting in the users home directory, and which contains the tag declarations of the format ...
coderodde's user avatar
  • 28.7k
1 vote
2 answers
182 views

PDF invoices from user input

Firstly the goal of this code is a little more complex than in this post and the other invoice questions are C# Is there anything that just pops out as immeadiately unpythonic/wrong ? I have a few ...
Lozminda's user avatar
  • 101
4 votes
1 answer
140 views

System Utility to Create Random Files

The following program makes random files. By default, they are of the form /tmp/rfile-XXX. Certain options allow for the user to specify where these files are ...
Jordan's user avatar
  • 79
2 votes
1 answer
145 views

php tmpdir() alternative to tmpfile()

tmpfile() creates a temporary file which is automatically deleted when php exit. I wanted the same for directories, came up with: ...
hanshenrik's user avatar
1 vote
1 answer
65 views

Class handling file conversion and data manipulation archiving [h5py]

I am a physics PhD student who co-developped a python package for file conversion of standard file format used in Scanning Probe Microscopy (SPM) and archiving of data manipulation for tracability. If ...
CoilM's user avatar
  • 13
0 votes
2 answers
61 views

Checking which programs are used for scripting

I have a directory where there are some script files, some binary files, and some subdirectories. I have tried to write a program which gets names of all files in directory, and excludes if they are ...
rnso's user avatar
  • 241
1 vote
1 answer
189 views

Version 2 of my Python Password Manager

I am still just starting out with python and just finished learning about classes, with no further understanding on many python modules. With this in mind, this is one of the biggest/hardest things I ...
Beginner's user avatar
  • 189
1 vote
1 answer
261 views

Collecting hashes of all files in a folder and its subfolders into a dictionary in Python

What I am doing here is iterating through all the files in the parentFolder and its subfolders collecting all the hashes of all the files and putting them into a ...
lungimiranza's user avatar
1 vote
2 answers
130 views

Display free disk space

With Kubuntu 22.04 ... Questions : What is a better way than using 2 cases? The 1st case, script Line 48 "case $x in" lets user choose to clear screen or not clear. The 2nd case, script ...
joseph22's user avatar
  • 159
6 votes
1 answer
757 views

Python File Transfer Script

I'm still pretty new at Python and working on a small database program, where at the start of the program new files are imported from another folder (approx. 2000), and older files are backed up. ...
Jan van Wijk's user avatar
8 votes
2 answers
460 views

Tar implementation

I am writing a tar implementation for education purposes and I started with reading from a tar file and printing the file content. I use recursion for getting the next tar header and googled "...
mortytheshorty's user avatar
4 votes
1 answer
277 views

Minimalist Recursive File Watcher (MacOS & Linux)

Looking for feedback, bugs, performance reports, and general code review of this simple file-watcher. Basic algorithm: The MacOS version just sets the relevant paths to be watched from the CLI ...
Jonathan's user avatar
  • 141
3 votes
1 answer
57 views

Wipe a directory tree

The idea here is to destroy the data in a directory tree by finding any files in it and overwriting their data with garbage before deleting them. The function returns minus the number of errors ...
CPlus's user avatar
  • 928
1 vote
2 answers
996 views

Geting file-names from the current working directory

The following routine returns the file-names from the current working directory: ...
user366312's user avatar
1 vote
1 answer
246 views

Delete files with specific filename pattern in directory with all extension using python

Preamble The first following code explains the context. ...
simone100's user avatar
5 votes
5 answers
576 views

Find the 10 largest files in a directory tree

I've recently finished a small project intended to better understand C. The program will output the ten largest files found (recursively in the event of subdirectories) in a specified directory. I've ...
John Harrington's user avatar
2 votes
1 answer
148 views

Implementing Linux style file name wild cards on Windows 10 PowerShell

Implementing Linux style file name wild cards on Windows 10 PowerShell While implementing an objected oriented wc on Windows 10 in visual studio C++ I implemented a recursive file search with a weak ...
pacmaninbw's user avatar
  • 24k
2 votes
1 answer
201 views

PHP Bootstrap Autoloader

I wrote an PHP Autoloader to include it "easyer" to my projects. Here the folder structure: ...
NvrKill's user avatar
  • 193
4 votes
2 answers
2k views

Clean up directories and files when a unit test fails

While running unit tests (most of them integration tests) with Python I create some directories. They need to be deleted after the test or when the test fails. The execution of the cleanup code need ...
buhtz's user avatar
  • 209
5 votes
2 answers
587 views

Automate the Boring Stuff Chapter 10 - Selective Copy by file extension

The project outline: Write a program that walks through a folder tree and searches for files with a certain file extension (such as .pdf or .jpg). Copy these files from whatever location they are in ...
Javana's user avatar
  • 451
15 votes
4 answers
2k views

Python tool to organize downloaded media files

I'm making a file management project that I eventually want to be automated later in the future (once I learn how to). What it does is take files from my download folder and move those files to the ...
Tam-Fils Salomon's user avatar
4 votes
2 answers
322 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 ...
Ramza's user avatar
  • 171
1 vote
1 answer
287 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 ...
Divan's user avatar
  • 113
2 votes
2 answers
111 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? ...
woxihuanxiayua's user avatar
3 votes
1 answer
1k 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 ...
Kostas's user avatar
  • 33

1
2 3 4 5
15