Sorting photo files takes time and effort. It is Korejanai who forgets the number or tries to print it while selecting it. Or looking at unnecessary photos. I want to see only the files I need! What's more, I made something like this for my own convenience because I wanted to sort it out easily.
When you start this (★★★ .EXE) from the photo viewer, it will create ★★★ on the current folder and move it to ★★★.
For example
Suppose you have files from 001.JPG to 005.JPG with this folder structure.
CANON001/ └ jpg ├ 001.jpg ├ 002.jpg ├ 003.jpg ├ 004.jpg ├ 005.jpg
In this state, if you start ★★★ while selecting 003.jpg in the photo viewer, a ★★★ folder will be created in the same row as JPG as shown below, and 003.jpg will be moved.
CANON001/ └ jpg ├ 001.jpg ├ 002.jpg ├ 004.jpg ├ 005.jpg ├ ★★★ ├ 003.jpg
Due to the characteristics of the photo viewer, the moved file will repeat the photos and images in the folder you are viewing, so you cannot see the moved file unless you change the folder you are viewing.
In other words, after moving, the photo viewer will only refer to the following files.
└ jpg ├ 001.jpg ├ 002.jpg ├ 004.jpg ├ 005.jpg
If you look at the images from the ★★★ folder after moving, you can see only the following files.
├ ★★★ ├ 003.jpg
Some preparations (environment where JAVA can be executed, revival of photo viewer) are required, but it is very easy to sort photos with just 2 clicks (1. Open → 2. ★★★).
Exe processing is carried out by launch4j etc. http://launch4j.sourceforge.net/
Refer to this area to enable the photo viewer. Editing the registry is quick and easy. https://popozure.info/20190823/14633
I'm sure you only want the executable file You can get the executable file by downloading it from here. https://drive.google.com/open?id=1dKcispHr8_D81kaPRgID7oKf27bEMfvS
starSelector.java
import java.io.*;
import java.util.logging.*;
public class starSelector {
public static final String LOGFILE = "StarSelector.log";
public static void main(String[] args) {
try {
final Logger logger = Logger.getLogger("starSelector");
try {
//Specify the output file
FileHandler fh = new FileHandler("starSelector.log", true);
//Specify the output format
fh.setFormatter(new java.util.logging.SimpleFormatter());
logger.addHandler(fh);
} catch (IOException e) {
e.printStackTrace();
}
File file = new File(args[0]);
File parentDir = new File(file.getParent());
//System.out.println("Parent parent directory name: " + parentDir.getParent());
String strParentDir = file.getParent();
String strFileName = file.getPath();
String strStarDir = "★★★";
File moveNewFolder = new File(parentDir.getParent() + "\\" + strStarDir);
//Read file check
if (!file.exists() || !file.canRead()) {
logger.log(Level.WARNING, "The specified file does not exist");
return;
}
if (file.getParent() == null) {
logger.log(Level.INFO, "The file in the Home directory is specified. Cannot specify the parent directory");
return;
}
//Diretry check
if (parentDir.getParent() == null) {
logger.log(Level.INFO, "The file in the Home directory is specified. Cannot specify the destination folder");
return;
}
moveNewFolder.mkdir();
//File movement implementation
File file2 = new File(parentDir.getParent() + "\\" + strStarDir + "\\" + file.getName());
try {
if (file.renameTo(file2)) {} else {
logger.log(Level.WARNING, "Failed to move file");
}
} catch (SecurityException e) {
logger.log(Level.WARNING, e.toString());
} catch (NullPointerException e) {
logger.log(Level.WARNING, e.toString());
}
} catch (ArrayIndexOutOfBoundsException err) {
System.out.println("How to use: java starSelector <Files to move>");
return;
}
}
}
Recommended Posts