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
0answers
11 views

How to feed data Excel file from C# language that can be retrieved? [on hold]

Guys I need to get the code to to insert data from C# to excel file that already connected;for the application sending sms from desktop to cell phone by invoking info from excel file which already ...
4
votes
0answers
36 views

Get time difference and delete file [closed]

I have a function which gets the time difference between the time written in the file name and the local time at the moment the function is called. The file name looks like this: ...
2
votes
1answer
58 views

Extracting ZIP, JAR and EPUB files

I wrote a utility class that is used to extract the contents of a ZIP file to a destination folder. This is a very small class, but it has several practical applications: it can not only be used to ...
1
vote
1answer
31 views

Alert on partition growth

I have a script that alerts me via email when a partition grows past a defined threshold in one hour. My script is run from cron hourly. Everything seems fine for 99% of the time, but occasionally I ...
0
votes
1answer
41 views

Delete folder if it exists in PowerShell

In my PowerShell script I'm trying to delete a folder, but only if it exists: if (Test-Path $folder) { Remove-Item $folder -Recurse; } I find myself repeating ...
3
votes
1answer
27 views

Recursively delete empty folders in Lua

I have written a script that run in WingFTP Server which has a Lua scripting engine built in. The script recursively deletes empty folders except the specified root folder. ...
3
votes
2answers
65 views

A “safe” copy function for Python

I have a Python script for doing "safe" file copying. There are a couple of rules for this copy function: Existing files should never be overwritten. So if I try to copy ...
3
votes
2answers
36 views

Search utility that searches through source code files

I'm working on a search utility that searches through source files. It's only the beginning of the project. It lacks a lot of features, but a backbone of the project works and it would be great if you ...
2
votes
1answer
39 views

Powershell photo sorter/mover

I'm just beginning in Powershell - This will be my first full project, start to finish, and it's quite small. I have already had experience in C#, which helps in this .Net based language. This ...
6
votes
4answers
228 views

Get list of files in directory with exclude option

This method returns the list of files (absolute path) in a folder (or tree). It allows filtering by extensions or filenames. The method receives the following parameters: ...
1
vote
1answer
18 views

Rebuilding WAR files in webapps directory

This script cleans up destination directory and copies file into it with new name. Can this intent be expressed more cleanly with shelly? ...
1
vote
2answers
238 views

Replacing thrown exception with more descriptive exception during file I/O

My code needs to open a specific file. Under certain (expected, but rare) conditions, the code will get handed a file path to a file that does not exist -- the path is expected to be otherwise valid ...
4
votes
1answer
58 views

Save File Manager

I made a class to manage saved file in drive with Swift, and I tried to do the best work. Can someone get me a feedback about this class? What can I improve? Is this a good way to save a file? ...
3
votes
0answers
46 views

MD5 hash comparison for two folders

Using this page for a starting point into comparing MD5 hash values from files in two different folders, I've put something together that outputs either Copied if ...
4
votes
2answers
42 views

Simple Ruby directory navigator functions

In the process of writing scripts to work with CSVs and other files of the like I found myself in the need of a way to navigate and select files for various purposes. I wrote the following function ...
3
votes
2answers
112 views

A program to shred files

The following is a program to shred files securely: ...
2
votes
1answer
56 views

Move and rename images into separate folders

Basically, we came up with this task at work. I was wondering if there's a shorter and cleaner way of doing the following in some other language (or even improving what I did with Ruby). We have a ...
4
votes
3answers
111 views

Directory Snapshot

The following code creates a recursive backup of a directory in the form of interlinked HTML files, structured in the same form as the input directory. It does not take the backup of the contents ...
4
votes
1answer
67 views

Replicating a file system

The goal of this is just to practice. I went off on a self-challenge to replicate something(So the names of the parts can be ignored), I'm not done yet (Though what is here is fully runnable), but ...
4
votes
2answers
79 views

Text files: Copy, Rename, Append/Merge together

I wrote 3 subroutines related to batch data processing, they will be used together. A bit of background, I wrote this for my admin colleagues who do not write code. An application dumps daily ...
3
votes
2answers
42 views

Recursive file copy function

I created this function and I'm unsure if it is sufficient for "real world use", because all code snippets on the net I found for recursive copy functions used functions like ...
2
votes
3answers
82 views

Torrent File Remover

This script to locate torrent files in a given directory, and if they have been seeding for 2 weeks, delete the files. I realize the comments are overboard. The reason for that is it's being shared ...
1
vote
0answers
90 views

FilesSynchronizer: Synchronize local and remote filesystems

I have written a library that syncs files between two filesystems. It works fine, but I'd like some other developers to have a look over the existing code. Maybe I can optimize something. It is using ...
1
vote
1answer
80 views

PHP class for file handling and creation

This is a very simple class to handle files. It allows to access, create and modify files in the system or 2 fake files (one in memory and other similar to ...
5
votes
3answers
54 views

Alerting for rapid disk growth

I have a server that is pretty stable (disk capacity) until a certain event occurs and then the drive grows over the course of two days until it is full. I wrote a very simple bash script but I'm not ...
3
votes
1answer
37 views

Do my Image Widths Exceed Limit?

I needed to find whether any image's width at or higher than a certain directory folder exceeds a limit. Is this code a good way of doing this, or is there a way in which it can be improved? I ran ...
2
votes
1answer
73 views

PHP include page index.php?page=GET safety preg_replace

I found a lot of working codes to include page in page on Internet but I could not find a safe code. So I decided to create one myself. The pages will be only stored in folder /pages/ and whitelist ...
4
votes
1answer
30 views

Process files in all subdirectories and save output to new files based on their current path

Sample files: ./data/foo/file1.xml ./data/foo/bar/file2.xml ./data/baz/file3.xml Corresponding output: ...
-4
votes
1answer
38 views

Reading temperatures from /sys

I have this code which is working fine but I would like to use Java 8 NIO in order to optimize the code performance. ...
2
votes
1answer
40 views

Implementing dirpath(3p) and fdirpath(3p) functions

I'm implementing a dirpath and fdirpath functions, which allow to retrieve path from the directory handle (or its descriptor). ...
10
votes
2answers
81 views

Test runner for Scala problems

I'm learning Scala and could use another set of eyes on the code below. I'm creating a test runner for the 99 scala problems set. I figure between actually solving the problems and working through the ...
7
votes
4answers
99 views

Recursive filename search

I have created a little program to search a set of folders holding documents scanned. The folder structure is as follows: c:\images\year\month\date\documenttype\firstpartofdocumentNo.\ the ...
4
votes
4answers
32 views

Indenting a function to recursively find filenames

I wrote this function that recursively traverses a given directory resolves the relative file-names to absolute file-names and yields the resolved file-name if it matches a given pattern. You can ...
3
votes
0answers
76 views

Caching in PHP using the filesystem

I wrote a simple class to cache data on a filesystem. The class also provides an internal cache using a static variable to avoid reading from disk for each request. ...
1
vote
1answer
48 views

Moving repeated files from one folder to another

I want to scan my whatsapp images folder and move all the repeated images to folder named recycle bin to delete them later: ...
2
votes
1answer
37 views

Find relative filenames recursively in Emacs

I have a set of directories. For each directory I have a set of relative file names. I would like to select any of these relative filenames using completion, and then later reconstruct the absolute ...
3
votes
1answer
153 views

Walk a directory tree recursively

Any suggestions are welcome. ...
3
votes
1answer
42 views

Get list of the executables in the current directory

This is what I've done; ...
6
votes
1answer
424 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
46 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
67 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 ...
5
votes
1answer
141 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 ...
6
votes
1answer
111 views

Make file paths relative to the configuration file path

I have a configuration file which holds several file paths. If these paths are relative, I want them to be relative to the path of the configuration file (and not to the path of the user working ...
3
votes
3answers
254 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 ...
5
votes
3answers
76 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
84 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
117 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
223 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
21 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
63 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 ...