Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env rdmd
- import std.stdio;
- import std.file;
- import std.algorithm.iteration;
- import std.regex;
- import std.array;
- import std.typecons;
- void move(string subfolder, string filename) {
- if (!subfolder.exists) {
- mkdir(subfolder);
- }
- auto target = subfolder ~ "/" ~ filename;
- rename(filename, target);
- }
- void main() {
- static ss = ctRegex!(`^\w+SS\w+\.avi$`);
- dirEntries(getcwd, SpanMode.shallow)
- .filter!(a => a.isFile)
- .map!(a => std.path.baseName(a.name))
- .filter!(a => !a.matchFirst(ss).empty)
- .map!(a => tuple(a.splitter(`SS`).front, a))
- .each!(a => move(a.expand));
- }
Advertisement
Add Comment
Please, Sign In to add comment