Use this tag for reviews of code that performs file system operations, such as creating, deleting, renaming, moving, copying, reading and writing files.

learn more… | top users | synonyms (1)

4
votes
1answer
279 views

Powershell search millions of files as fast as possible

I once asked a similar question but in C#. Now I have the same problem in powershell.. What is the fastest way, to search files newer than 15 minutes, in a file system with more than 1 million files? ...
0
votes
0answers
31 views

Error handling in directory iterator using promises

I wrote this example of IS.File.directoryIterator for Firefox. Can you please help me to review it so if an error occurs it is caught? I'm not so great with ...
3
votes
2answers
43 views

Python path-breaking script for use in R

R does not support line continuation as Python, and it's disturbing to have long file paths like /media/user/data/something-not-very-important-but-super-long/some-curious-secret-file.pdf and ...
4
votes
1answer
105 views

C# photo sorter

I am quite new to C#, currently working through a number of pluralSight courses. I've written a few small things here and there, but never anything that performed an entire purpose/function from ...
3
votes
3answers
104 views

Search through .xml files for text that exists anywhere in the file

I have about 1000 .xml files in different sub directories under one root folder. My root directory contains the below structure: RootDir\172\00ad8dc-bff\25.0.xml ...
4
votes
3answers
41 views

Check disk space against a threshold

The below script is one I made to check the disk space on mounted partitions under Debian Wheezy. I tried adding a -d switch to force printing out the used data, ...
6
votes
1answer
54 views

Monitoring directories for files that are generated by an engineering program

I have a service that monitors failure and success directories for files that are generated by an engineering program. I want to check the change was in the success or failure folder, and if it was a ...
3
votes
3answers
74 views

Find directories containing jar files and call other program to scan them for vulnerable versions

I wrote a Python script to collect a list of directories containing third party libraries and submit them all to dependency-check, a program that compares library versions to known-vulnerable third ...
2
votes
2answers
87 views

Fastest way searching specific files

I got thousands of files with a specific file extension in thousands of sub folders. Now, what is the fastest way to search with a pattern? I tried the method ...
1
vote
0answers
17 views

Filesystem-dependant unit-testing in go

I recently rewrote a piece of software to practice unit-testing. I decided to constrain myself and do dependency-free code, so I can do better and easier tests. I came to the following solution while ...
4
votes
1answer
53 views

Copy directories while changing Unicode filenames to ASCII

I created a short Perl 6 script copyfnameascii.pl to copy a file hierarchy I have, applying an URL Decoding to the names of folders and removing non-ASCII ...
5
votes
1answer
62 views

TrackDAO: what can be improved?

In this specific situation there is a table with trackdata and a form to add rows. For the sake of clarity I won't include the view-related code here. The added rows are added to a LinkedList when ...
2
votes
1answer
70 views

Enumerate directories to a given search depth

Since I had been in the need of finding directories from a startpath with different search depth levels, I created this little helper class. This class is using objects of the ...
3
votes
3answers
59 views

Copy a directory from source to destination

I wrote a program that copies a directory from a source to a destination, similar to the cp utility. For this, I used the essential functions: ...
3
votes
1answer
46 views

Rename files to titlecased

I wrote this Python script to rename specified files to "titlecase", for example: hello.txt to Hello.txt ...
4
votes
1answer
43 views

Rename files to all lowercase letters

I use this Bash script to rename specified files to all lowercase letters: ...
1
vote
0answers
32 views

Safely include requested pages without a whitelist

Is this pretty safe from breakout attempts? I'd rather not make a whitelist and check if the requested page is in the array since theres a ton of pages. And I wanna keep it clean. So I'm looking for a ...
2
votes
1answer
53 views

Counting the lines of a compressed file

This is a Python script for counting the lines of a compressed file: ...
2
votes
2answers
66 views

Handling thread interruptions in a directory iterator

This code is code written on a whim to help $someindividual asking for such a thing on $somechatmedium; what is needed is a way, ...
7
votes
1answer
86 views

Changing desktop background to the next available one

How could I improve this working Perl script, which changes my desktop background to the next available one, without opening a terminal? Specifically, how could I iterate over my .fehbg and walls/ ...
4
votes
1answer
45 views

Copying files in Haskell

I recently watched a video in which the speaker said that Haskell is not suited for real-world tasks, such as copying files from one folder to another. So I tried to write a program that copies a ...
1
vote
2answers
73 views

Backing up an entire website with PHP

I'm attempting to backup lots of website using this php code. The script basically goes through the whole public_html directory and adds all the folders and files recursively and zips them. Here's ...
4
votes
1answer
64 views

Ruby script to create git repos

I wrote my first ruby script, by this tutorial. It creates a local and remote git repo. I have been working for about 3 years with PHP, and somehow I find that my ruby script looks incredibly ugly. ...
3
votes
1answer
25 views

Renaming and moving files in a subdirectory with an index and the folder name

I'm putting together a script to take .mp4 files organized into folders that described the video (eg. cat) and I'd like to do the following: rename them with the folder name and a number move the ...
3
votes
1answer
329 views

File Exists Script Task for SQL Server SSIS

I have an SSIS package for SQL Server 2008. In this package, I need to verify that a file exists that matches a pattern of SomeFileName_*.txt where the wild card ...
3
votes
2answers
47 views

Merge all files in a directory with a specific extension

I come from Python, with a bit a FORTRAN and Matlab some years ago. I'm trying to learn C. My first attempt at a program is one to merge all the files in a directory with a specified extension ...
5
votes
2answers
221 views

Random song playing app improvements

I have a substantial music collection, which will not load entirely in any music program. So I wrote this quick program, to play a random song in a subfolder of my music directory. I'm just ...
-3
votes
2answers
103 views

Operating on files from source directory [closed]

I have a small program that does a fairly trivial task. I am unhappy about the fact that I have everything in Main or called from ...
4
votes
1answer
46 views

Unit testing a bash script manipulating the working directory path

bd is a bash script to conveniently jump multiple directory levels up from the current working directory instead of a tedious and possibly inaccurate ...
2
votes
1answer
70 views

Clear cache files older than 30 minutes

This is what I came up with to delete files not modified within the last 30 minutes from a subdirectory named cache. ...
8
votes
2answers
123 views

List files in a directory

I have folder1 that contains other folders (which may contain other folders etc). This process stops at some point where a folder contains only files, and some of ...
4
votes
1answer
55 views

Glob-Like Search in VBA

The Dir() function in VB and VBA can accept wildcard characters (* and ?) but only in the basename of the path. ...
3
votes
2answers
357 views

Concatenating rows in CSV files and removing old CSV files

I have written my first Python script that will go into live use at my workplace. I am relatively new to Python and I think this script is pretty good but I would like your input. It runs very fast, ...
2
votes
1answer
86 views

Should I add a function that takes as parameter a ptree?

I have a class ConfigFile that reads some values from a JSON using Boost and store them in variables. Everything is done in the constructor: ...
6
votes
5answers
236 views

Mounting multiple partitions on a disk

Is it possible to improve the code of this bash script? ... or should I just use another language? (If so, which one would fit the best the situation, according to you?) Here is the code (simplified, ...
1
vote
2answers
63 views

Putting all desktop items into a new folder

I'm quite a newbie with Python, but I wanted to try my own little project, so I made a small script that puts all the desktop icons/folders into a newly created folder (called "Desktop1") if there are ...
0
votes
1answer
34 views

Searching for files across multiple code projects

I was tasked with conducting a large number of text searches in the code files of multiple projects. Initially, I just used the Find in Files feature of Visual Studio in a couple of the running ...
1
vote
0answers
58 views

Tree Utility in Python

I wrote this piece of code to mimic the *nix tree utility, however, I am not happy with the pad_info=[] part. It's used to make padding according to whether the ...
4
votes
1answer
108 views

Database and file backup script

I created a Backup class because I couldn't find one that worked well on Windows and remotely, to do this I have combined a lot of questions on stackoverflow with a lot of trial and error to get it to ...
5
votes
3answers
561 views

Splitting a path string

I have the following C# method to split a path string. The only thing I know is a fixed string in the path and I have to split the full path into two parts, first part should be one level below the ...
10
votes
2answers
325 views

Minimalistic rmdir

In my eyes most of the GNU stuff is bloated and doesn't really fit my view of how a Linux environment should look like. I have come up with my own minimalist implementation of the GNU Coreutils, but ...
-1
votes
2answers
173 views

A platform-independent implementation of “which” in Ruby

I like to know if there's anything that I may have missed in this implementation. The method tries to provide the absolute path of the binary or script which is likely to execute based on the provided ...
4
votes
0answers
45 views

Reading OS X file tags

I'm investigating Go for use in our internal network / office project management system, and need a way to check and edit the color tags that you can set in Finder on files or folders (extended ...
5
votes
2answers
172 views

Directory listing model

I need a class to read and store directory structure. This is my first step in Objective C so I ask to you to say what you think. Header file: ...
-2
votes
1answer
33 views

Should I contain use a variable to avoid mentioning a filename twice? [closed]

for example i'm deleting file if it exist if(file_exists('path/to/file')){ unlink('path/to/file'); } or is it better to use ...
3
votes
2answers
120 views

Group and send all files to filetype folder

I have around ~2M of files in one folder, which I need to manage. So, I want to separate them in groups by their filetypes. Example: filenames ...
4
votes
1answer
100 views

Cart mover- OOP usage and learning design patterns

Firstly, I would like to say that this site looks fantastic... I haven't tried it out yet, but I'm coming from SO, so I think it will be great. My code is for a simple "cart-creation" class and ...
4
votes
1answer
66 views

Pathname matching and listing program

This Python 3 program outputs a list of all pathnames in the filesystem that match a list of rules taken from a file. You can add and remove sets of pathnames. The original purpose was to generate ...
11
votes
3answers
171 views

Scanning a directory for plugins and loading them

I'm working on a simple dictionary tool, with a base class that can be extended by plugins to represent different dictionaries. The plugins are organized in the filesystem like this: ...
3
votes
2answers
362 views

Alternate method of iterating than os.walk

Recently, I became tired of how slowly os.walk seems to run (really, it should be called os.crawl), and made something recursive ...