Stack Exchange Network

Stack Exchange network consists of 174 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.

2
votes
0answers
13 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
49 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
36 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
39 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? ...
7
votes
3answers
120 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
48 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
50 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, ...
3
votes
1answer
29 views

Script to clean up old files that should only run one instance

I'm writing a bash script for deleting old files on a Linux server. Here are some relevant facts about this script: As currently written, it does work as expected. However, it's entirely possible ...
6
votes
2answers
100 views

Walking directory tree like python does

I like python's os.walk and I was missing it in C#. It's a very convenient API so I thought I create my own utility that does something similar. The original API ...
3
votes
2answers
62 views

Searching repositories for files with forbidden strings

I wrote a small tool for searching git repositories for forbidden strings that I don't want to commit publicly. It's still something basic but it does the job. The project contains three files. <...
3
votes
1answer
62 views

Moving or copying images from a flat directory to subdirectories

I have a huge Google Photos directory that is difficult to navigate - there are just too many files so I thougt I need to sort them somehow. I decided to make it simple and group them by date-taken. ...
2
votes
0answers
30 views

Trying to create a directory if it doesn't exist [closed]

I am trying to create a directory, but I have to check whether /usr is present initially, later /usr/local is present and so on, ...
0
votes
1answer
80 views

Delete temp files and empty recycle bin

I was wondering if someone could help critique this code I put together. It is supposed to delete all temp files and folders and then empty the recycle bin. I had to make some adjustments because ...
1
vote
0answers
40 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
1answer
59 views

Find a folder in Java

I am making a website which should host a lot of PDFs. These PDFs are stored on the HDD. There are DossierIds in the database which correspondent with the folder name. In these folders there is 1 ...
2
votes
1answer
111 views

C++ - Object Oriented File System Design using Composite Design Pattern

I am trying to come up with a good File System Design using C++ / OOP. This is being done to gain an understanding of System Design and Design Patterns. I have some basic functionality, like reading ...
1
vote
1answer
54 views

Short Ruby program that opens a random video file from a directory

I am currently learning to code in ruby. I have created a small program that iterates through a directory of video files and opens one at random. The program is fully functioning (with the odd issue). ...
2
votes
0answers
30 views

Attempt to Save (Recover) files from a broken external drive

Here's my first question for Code Review. (I'll be happy to try to improve the question upon comments.) Problem: My external drive that I use for Backup had some broken files. I feared that I'd lose ...
1
vote
1answer
34 views

Powershell for syncing Minecraft save files

My code in full plus the task scheduler definition: https://gist.github.com/DaneWeber/0c5e7978bd3927734173e3afdc3d6338 This is my first non-trivial PowerShell script. This was a pretty major learning ...
-1
votes
1answer
105 views

Java code for delimited raw file read with multi line record

I have written a simple program to read file that contains record spread between multiple lines. There is requirement to read file from source that is dirty and contains line breaks which are ...
2
votes
0answers
20 views

Sorting files into subdirectories based on keyword scores

This script sorts files from current directory into known subdirectories. it is built for speed because the keyword database used can be up to 20kb. each line of the database has ...
6
votes
2answers
221 views

Pick a random file from a directory tree

I'm working on a python module to randomly choose a wallpaper for my desktop background among thousands of pictures in my photo library. I though I'd make a general function: ...
2
votes
1answer
43 views

OOP implementation of in-memory file system

I was working on this problem, where I am constructing a Object Oriented structure of file system where you can have Directories and Files. The Directories could have sub Directories and files. I ...
3
votes
2answers
125 views

Find duplicate files in Linux

This code finds duplicate files in Linux. I assume that MD5 hash will return unique hash number. What can I improve in this code? ...
4
votes
1answer
41 views

Simple server log backup script utilising AWS

I have server side log files written to various directories throughout the course of a week. I have the need to optionally compress, and archive these files to AWS. The script I have come up with ...
2
votes
1answer
106 views

Export data from matrix to txt file [closed]

I am new at programming and I'm really confused about how should I do this, because at first I thought I should ask user which path to export. However I have been told that I should check if it exists ...
1
vote
1answer
56 views

Loop through array of files and rsync to Dropbox

The goal is pretty straightforward. There’s a list of dotfiles from my home directory. It loops through them and rsyncs all file to a Dropbox folder for backup ...
7
votes
2answers
481 views

Find files by pattern and copy to target location

This is my solution to the Chapter 9 exercise in Automate the Boring Stuff: Selective Copy Write a program that walks through a folder tree and searches for files with a certain file extension ...
0
votes
1answer
44 views

Count lines of scala code (omitting empty lines) in a directory, traversing any subdirectories

I need to simply count lines of Scala code in a project, which includes some package(i.e. directory) hierarchy. I'm not sure about the performance of the code below. Can you help improve it, if ...
3
votes
1answer
54 views

Get owner of ~5 million files and folders using Powershell and Robocopy

I've written a Powershell script that uses Robocopy to get the full path of all files on a drive and then run it through a foreach loop to get the owner for each file and generate it in a CSV. The ...
3
votes
2answers
88 views

Disassembler for intel 8080 v2

As many suggestions were given for the code I posted here, I decided to show you the new version for review. I Removed the OpenCatalog class, ...
6
votes
2answers
105 views

Command line tool, listing video files on a local drive

Explanation I started learning Haskell about a month ago. As an exercise, I recreated a little command line tool, which I had previously written in PowerShell. In the current state, it displays a ...
10
votes
2answers
157 views

Disassembler for intel 8080

I have written a disassembler for Intel 8080, able to translate binaries into opcodes and parameters. Sorry for posting so much code, but everything posted here is useful for the understanding of the ...
2
votes
2answers
75 views

Listing files whose names match a pattern with a date

My directory folderMarket has lots of files with the same name but are tagged with a date string at the end. The date tag can be formatted differently, e.g. "2018-...
2
votes
1answer
29 views

Finding incorrect yml headers

Introduction I am working on a semi large project with a few hundred files. In this project there is a series of lesson.yml files I want to check is formatted correctly. And, yes, every file I want ...
6
votes
2answers
331 views

Scan similar files in different directories and report differences

I wrote a program in Python that scans all files in a directory, makes dictionaries with stuff like date of creation and a hash of the contents of a file. Then i scan another directory which is just a ...
1
vote
1answer
41 views

Create directories for outputs based on setting

I have a dict with a series of bools to specify if a particular aspect of my program will be run (e.g. settings['A'] and ...
0
votes
1answer
69 views

Git hook written on JavaScript

As in many teams, me and my coworkers are putting ticket number into beginning of each commit message. If your branches are starting with ticket number it is easy to create ...
0
votes
1answer
55 views

Maintaining a temporary directory

I have this class/service, which I need to maintain. Its purpose is to manage a temporary directory so that all content can be deleted on next restart files are not left behind when you're done with ...
1
vote
0answers
42 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 ...
-2
votes
0answers
25 views

Move image files according to watermark identified by a neural network [duplicate]

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 ...
3
votes
0answers
45 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
1answer
56 views

Automating the installation and configuration of Vim

I am writing a script to automate the install and configuration of vim, zsh, ohmyzsh and tmux, on a Linux/Mac. I'd like to perform all operations in Python, rather than using ...
2
votes
1answer
53 views

Scanning directories and caching paths to an array

What am I trying to do I'm trying to scan a disk and save (cache) all the paths of files and directories into an array so that I could perform a quick file/directory search later on. Implementation ...
1
vote
0answers
427 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 ...
3
votes
3answers
165 views

Iterate over filename [closed]

My program inspects filenames which are delimited via underscores. So an example may be: This_is_an_example_of_my_filename.tif A counter example may be: This_is_a_very_bad_document.tif The ...
4
votes
1answer
267 views

Media player subtitles in WPF - Part 1 Processing and storing

I'm writing a media player in WPF and since movies are playable, subtitles are a must. Here's what it looks like so far: On the left is the settings tab, in the middle is the actual player and on ...
2
votes
0answers
41 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: ...
3
votes
3answers
1k views

Get files recursively as relative paths

I want to get a recursive list of files in a directory but I want relative paths and not the full paths that Directory.GetDirectories() would return using the ...
5
votes
2answers
64 views

Merging two files' lines of text for output

My program is supposed to merge two text files' lines together. For instance, if I have two files, one.txt: ...