This is for windows
What does it do?
- Set the original_folder to a parent folder with the subfolders you want to consolidate.
- Set the destination_folder where you want the files to go
- It renames the files with the subfolder name so you don't have duplicate names
- Then it moves the files into the destination folder
The current implementation will modify the names of files in your source folder
Here Is How You Set It Up
- Create a text file with note pad
- Copy and paste the code below into the text file
- Rename the extension to .vbs
Heres Is How You Use It
- Edit the file changing your "original_folder" and "destination_folder" files to the names of your file paths. Original_folder should be a parent folder that contains the subfolders you wish to consolidate
- Double click
- All the files in subfolder_1 will be renamed with the subfolder name as a prefix photo1.jpg -> subfolder_1_photo1.jpg
- All the files in subfolder_2 will be renamed with the subfolder name as prefixx photo1.jpg -> subfolder_2_photo1.jpg
- All the files will be copied into the destination
- The way this script is currently written it will change the names of the files in the original folder so make sure you use a copy if you need to retain the original names
'Original folder - parent folder that holds subfolders to merge
original_folder = "c:\Fieldwork_parent_folder"
'Destination Folder - where you want the photos to go
destination_folder = "C:\Fieldwork\all_photos"
'Set up your variables
Set fs = CreateObject("Scripting.FilesystemObject")
Set f = fs.GetFolder(original_folder)
Set fc = f.Subfolders
'Loop through the subfolders
For Each f1 in fc
msgbox "Starting " & f1.name
SubFolderSpec = original_folder&"\"&f1.name
'Loop through the files and name them with the subfolder name
For Each f In f1.Files
'newname = ""
newname = f1.name &"_"& f.name
f.name = newname
'Copy files from one folder to the other
fs.CopyFile SubFolderSpec & "\*.*", destination_folder