"Bulk renaming Utility" PROBLEM SOLVED
Granted this is a little late, but I have solved the
"Bulk renaming Utility" (extra text at the end of files) time-stamp problem. Trust me, IT IS SIMPLE, just follow the instructions. If you follow the instructions, it should take no longer than 10 minutes to complete :)
I recently graduated from a coding academy and was determined to create the solution using the Java Programming Language since I couldn't find an adequate solution online. I will outline what you need to do step by step. I realize many people may not
have a programming background so if you want to skip some steps go right ahead. However, I explain everything below:
1. Download intelliJ (this is where you will enter the code I wrote)
https://www.jetbrains.com/idea/download/#section=windows
2. Install (I recommend accepting all default settings as we have only one particular purpose)
- Open (if not automatic after install) and click on "Create New Project"
- Don't change/click on anything on first screen just click on "Next"
The second page, click on the "use template" then click on next
5. Name the project "rename"
6. Close out the tip bar. You should see code that looks something like this:
package com.company;public class Main{public static void main(String[] args){ //write your code here }}
On the task bar, Click on "View" >> "Tool Windows" >> "Project"
7. Under the name you chose in Step #5 ("rename" but can be anything), navigate to folder "src" and right click it
8. Go to New>>Java Class>> And name it "Traverse" (must be capitalilized)
9. In the "Traverse" page, paste this code right after the very first opening bracket, i.e., the thing that looks like this --> "{" :
public static void traverse(File dir){if (dir.isDirectory()) { File[] listOfFiles = dir.listFiles();for (int i = 0; listOfFiles != null && i < listOfFiles.length; i++) {if (listOfFiles[i].isDirectory()) {traverse(listOfFiles[i]); }if (listOfFiles[i].isFile()) {//delete unwanted substring here String original = listOfFiles[i].toString();String toRemove = " (2017_08_25 16_38_09 UTC)"; String new_name = original.replace(toRemove, "");//permanently chane name of file File oldfile = new File(original); File newfile = new File(new_name);if(oldfile.renameTo(newfile)) { System.out.println("File renamed"); }else{ System.out.println("Sorry! The file can't be renamed."); } } } }}
Afterwards, it will likely ask to import "java.io.File", say yes
- VERY IMPORTANT:
In the above code, one portion is underlined & in italics. That was the date ON MY COMPUTER! Your date to remove WILL LIKELY be different. If so, CHANGE IT!
Also, keep the space after the opening quotation mark. It is important so your files don't have an weird space after EVERY file name, e.g., Hello.txt opposed to Hello .txt
11. Click back on the "Main.java" page, delet the "//write your code here" and copy/past the following:
File test= new File("C:/User/jacquan/Desktop/test_folder"); File folder2 = new File("put YOUR path to folder with UTC dates here"); File folder3 = new File("can do as many folders at once as you want"); Traverse files = new Traverse(); files.traverse(test); files.traverse(folder2); files.traverse(folder3);}
Again, it will likely ask to import "java.io.File", say yes
12. You are almost done, all you have to do is change the path (if unsure what that means, google this exact phrase "find folder path for mac/windows")
FYI: the path of your folder(s) that has the unwanted dates goes inside the parentheses with green text AND inside the quotation marks
And if it's not obvious, if you only have one folder, and you change only one folder path, delete the other two options as this solution will not work properly.
*************************************CAUTION******************************************
For some reason people often mess up directions. I advise you to create a test folder on your desktop. In the test folder, copy/paste a few files and folders (with files) that have the time stamp .
See Step#13
Please check that folder before you do anything to your original files. If the test folder deletes the unwanted characters, then put the original paths back in the code and proceed with instructions.
*************************************CAUTION*******************************************
13. On the top right of the screen, there is a sideways triangle (a play button), click it.
14. DONE!!! GO CHECK YOU FOLDER(S) DATES FREE!!!!!
I hope this helps, if you have any questions, please feel free to ask :)
If this worked, you can uninstall intellij if you want to.