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
7
votes
3answers
4k views

Finding and deleting duplicate files in a folder

The following code aims to identify and delete duplicate files in a folder. At first, files are compared by size, and then (if needed) by hash. The helper function ...
1
vote
1answer
1k views

Deleting EXIF metadata from pictures

My app is about deleting exif metadata from pictures. Also, what do you think about the code quality (OOP principles, clean code)? Is it production-ready? GitHub MetaWipe.java ...
7
votes
2answers
520 views

Retrieve filetype:pdf from library

I retrieved all the books in pdf from my library with a recursive function. ...
6
votes
1answer
118 views

FAT16A/B disk and file variable initialization program for MS-DOS

Typically I use DOS file services for disk access, so that I don't have to care if the files are on a network drive, or CD-ROM, or in a mounted DOSBox folder. In the future, however, I would like to ...
0
votes
1answer
873 views

Efficiently Sorting File Paths [closed]

I'm trying to print out a list of files in a specific order, with files closer to the root directory sorted first. For example these files: c:\users\steve\foo.txt c:\users\bar.txt c:\users\steve\...
7
votes
1answer
6k views

SMB Script which collect remote files, mount locations, unmount locations, and show directory file tree

I've written a script that is able to accomplish the following: mount/unmount a remote SMB location using the subprocess module List the file contents of a specified directory copy a single file out ...
10
votes
2answers
273 views

Reading a proprietary file system and creating files

The goal of this software is to read the proprietary file system index of a digital video recorder and to carve all of the video chunks into files within a dated directory structure. I'm not very ...
3
votes
0answers
159 views

Follow-up: Script to create symlinks for dotfiles in a Git repository

This is a follow up to my previous question on Code Review. I did try to implement most of feedback provided by thiagoalessio. This is what my updated code looks like: ...
4
votes
1answer
729 views

Script to create symlinks for dotfiles in a Git repository

I have a GitHub repository containing all my dotfiles for bash, tmux and neovim. I'm using a ...
0
votes
1answer
10k views

Getting the grandparent directory of the current code [closed]

I have this example: from os.path import dirname, realpath dirname(dirname(dirname(realpath(__file__))) And the chained ...
2
votes
1answer
54 views

Implementing POSIX file mode library

I implemented a virtual file system library with POSIX file mode representation. Any suggestions regarding optimization are welcome. ...
4
votes
1answer
455 views

Read contents of file with appropriate error handling (Rust)

I am trying to learn basic Rust. Is this a good way to get the contents of a file? Am I handling errors the best way? Is there any way this could be more performant? ...
3
votes
0answers
43 views

Rewriting the GnuWin32 Touch Command with the Win32 API

There are essentially two options for Windows users accustomed to the *nix command-line functionality; you have to either download a framework like Cygwin/Msys or use the GnuWin32 packages (of which I ...
2
votes
1answer
2k views

Compare same filenames with different extensions

I wrote this piece of code below, but I'm sure it can be done in a more Pythonic way. Only, my knowledge is not that much to be able to figure out a more efficient way. The DOCX and PDF files are in ...
1
vote
0answers
75 views

Async function to write products to file

I'm currently trying to learn how to use await/async functions. Could anyone offer any thoughts on how to improve this function which uses await inside a for loop? ...
4
votes
1answer
215 views

QuickSearch for files and directories

I have a project where I need to search for directories and files. In fact I'm searching for paths in other projects. I don't want to just find files but I also want to exclude some directories or ...
1
vote
1answer
4k views

Checks size of and number of files in each subdirectory

The code snippet here checks in every folder for subfolders, and stores the sub-sub folders This is my sample directory structure. I want to read through every sub-folders to find the number of files ...
2
votes
0answers
208 views

Syncing NTFS permissions with SMB share permissions

I recently wrote scripts to automate the setup of shares on a server using the New-SmbShare cmdlet. I hadn't realised that this cmdlet doesn't automatically amend ...
2
votes
1answer
136 views

Combine two .log files and write into a single log file with sorted list based on timestamp

I'm writing a C program called "mylogger". It is a simple program that merges several log files in order of timestamp. For example, we have server.log: ...
4
votes
0answers
335 views

Generate NDVI Rasters from USGS EarthExplorer Landsat 8

I've written the following using Python Dictionaries and Pathlib Module. I'd like to improve the first function: list_landsat_bands. I've created a list of file patterns to match, which I then use ...
7
votes
1answer
698 views

Implementing a temporary data context manager

I implemented a context manager to handle temporary files and directories. ...
2
votes
0answers
691 views

C# FileSystemWatcher Manager with Debounce

For a class last fall I was working on a "cloud backup" system. Originally in Pascal, I decided to rewrite it in C# and expand the feature set. Below is the FileSystemWatcher "manager" class which ...
3
votes
1answer
109 views

Windows directory tagger in C++

What I have this program that allows me assigning tags for directories and then change working directory to the directories via their tags. Installing In your home directory, create a folder ...
5
votes
1answer
1k views

Finding large files

Just looking for some feedback. I designed a script to find big files that are taking up lots of space. Still a beginner, and appreciative of constructive feedback, with both the function and form/...
0
votes
1answer
435 views

Find common directory path

I answered the problem of Find common directory path from Rosetta Code. The problem consists of passing '/home/user1/tmp/coverage/test', ...
3
votes
1answer
194 views

A script to remove unneeded files

The hard drive in my dev box is running out of space so I wrote this little script to try and free up space until I get a new drive. My Concerns Is the code pythonic? Does the code go against any ...
4
votes
1answer
5k views

Duplicating Excel-workbook, and transferring data

This is a follow up to the simpler question here. I have hundreds of files looking something like this: These files have names such as: ...
0
votes
1answer
555 views

“Quick” save in electron with a conformation dialog

I have implemented a "quick" save for my electron app. There has to be a better way to achieve what I am doing. The MessageBox will always be triggered on a save ...
3
votes
3answers
5k views

Change filename of Excel-files based on the content of a cell

I have hundreds of Excel-sheets looking something like this: I can't use the actual sheet, and not the exact document numbers, since they are confidential. The name of the files are something like ...
2
votes
1answer
489 views

Typescript: Recursion file-system lookup

Previously I asked a question to find the best practice of recursively running a function to retrieve all import/export statements of files in NodeJs here. After some discussion I'm not satisfied yet,...
3
votes
1answer
618 views

Recursively find TypeScript files imported/exported from an entry point

I'd like to know what's the best practice as functional programming in JavaScript to work with arrays and passing them as an argument to a recursive function that may run itself within its branch. In ...
5
votes
2answers
66 views

Extracting parts of filenames from an array

I am very new to perl. So far I love it, my new favorite interpreted language. I am quickly learning that perl has MANY 'tricks' to it. The following code extracts file names out of one array and into ...
12
votes
2answers
853 views

A minimal CLI password storage and retrieval manager

Its primary function is to retrieve+copy a PW to your clipboard. It'll also add, update, delete key/value(accountName/password) pairs from a JSON formatted dictionary(separate .txt file). It's ...
3
votes
1answer
126 views

wxpython program to clear the Desktop or restore files to the Desktop

This is a program that clears the desktop and also undoes the clear. How does the code look? Could I make it look better? ...
6
votes
5answers
3k views

LINQ-inspired recursive file search

I've been working on a configurable tool that finds files by a certain specification and returns a list. I attempted to approach this in a more LINQ way and tried using appropriate design decisions, ...
2
votes
3answers
96 views

Generate a list of the last 100 modified folders

This is a subroutine I have written as a part of an Excel VBA script. I usually write vb.net or Python but I need the final results for this project in Excel so I'm using VBA. My initial task is to ...
5
votes
1answer
337 views

Draw a directory tree

My goal was to create a simple-to-use CLI program for drawing directory trees (what tree does on most platforms, basically). I'm submitting my 'backend' program for ...
4
votes
1answer
115 views

Python Batch File Renamer

I'm working on creating a batch file-renaming application that renames specifically the way I coded it. Essentially, these files should be renamed from RootFolder ThisFolder ThisItem [Incorrectly ...
2
votes
3answers
10k views

Web API for reading file system

I will have this code reviewed by back-end devs tomorrow as part of an interview process tomorrow and would like comments on how to improve A) structure B) performance. For structure, it's too late ...
1
vote
1answer
78 views

Getting absolute file path

Part of my code: ...
3
votes
2answers
123 views

Command-Line tool to find large files on a Linux system

Is the code pythonic and easy to read and understand? Is there a better way to exclude directories? Did I miss any bugs? ...
11
votes
3answers
1k views

Path shortener for GUI application

I need to display a path within a GUI application. Displaying the whole path would be an overkill, so I made a custom path shortener. ...
3
votes
4answers
131 views

Finding .txt files that exist in one directory but not the other

I need to check a condition, and based on the condition perform a very similar for-loop. ...
3
votes
1answer
305 views

Haskell Listing Directories in Working Directory

I've got this fairly simple program to print out each subdirectory of the working dir. ...
4
votes
2answers
3k views

generate a file name with format Name(Number).extension

I am writing a program which downloads a file from a URL. Because the name of the downloaded file depends on the url, there is a risk of duplication if the user downloads the same file twice. For ...
1
vote
1answer
58 views

Read date from a file and rename two files using the date

Problem I have image files that are RAW data and have the extension .NEF Whatever edits I make to these files are stored in what is called a sidecar file with the ...
3
votes
0answers
956 views

Compressed static file serving in flask

Flask comes with built-in static file serving, but compression support is completely missing. I think the way whitenoise implements it and compress files during builds. The following should serve the ...
10
votes
2answers
521 views

In memory data access for CSV files that may have changed

I'm reading data from CSV files and store the result in a simple DataContext instance that gets injected throughout my application. ...
3
votes
1answer
2k views

Generate next available filename based on current date

I have a bit of code that I would like your collective opinions on. Currently, my working code has two return statements. I'm not sure how I feel about having multiple points of exit, however, the ...
8
votes
1answer
2k views

Speech Recognition Part 3: Training the Neural Network

The last part of my speech recognition series: finally training my network. Here's the dataset I did it with (self-generated, small I know), and the code I used. After running this code (takes ...

1
3 4
5
6 7
14