Create folder in selected folder with OS X Automator - macos

I am trying to batch convert a bunch of raw image files on OS X. I would like to use built-in software since it is possible.
First I would like to
let the user select the input folder containing the raw files;
create a new folder jpgs inside of that folder;
copy the raw files from the user selected folder into jpgs.
This is the workflow I have implemented so far in order to implement the first two steps.
First I let the user select a folder and store it into the variable NEF Folder. The I create a new folder named jpgs in the folder chosen by the user (NEF Folder).
BUT this is what the workflow does after selecting folder AAA on the Desktop:
Why?

Understood.
The action New folder creates a folder and copies its input inside of the newly created folder.

I have the same issue and solved it checking the box "Ignore this action's input".

Related

I'm looking to have a Folder recognise new files being saved into it and then copy new files into a collated folder

In MacOS i want a folder action to trigger when i place a new file into a subfolder. The action should grab a newly added file to the folder and copy it to another folder where all the latest files are collated and can be viewed together. I also want the script to delete any old version of the same file it copies across to the collated folder. The trouble is the file names are slightly dfferent as they have a version number in them. The version number is defined as "v01a" to start with but can change to "v01b" or "v01e" or "v02a" or "v03c".
So if a file called "1234_ProjectName_Image01_COMP_v01a.jpg" already exists and a new file called "1234_ProjectName_Image01_COMP_v01b.jpg" is added the the file called "1234_ProjectName_Image01_COMP_v01a.jpg" needs to be deleted from the destination folder.
I've tried a few times to get started in automator but never really get the pieces in place for it to be useful.
(SOURCE)
Dailies/_Internal
Dailies/_Internal/Image01/1234_ProjectName_Image01_COMP_v01a.jpg
Dailies/_Internal/Image02/1234_ProjectName_Image02_COMP_v01a.jpg
Dailies/_Internal/Image03/1234_ProjectName_Image03_COMP_v01a.jpg
(DESTINATION)
Dailies/_Latest
Dailies/_Latest/1234_ProjectName_Image01_COMP_v01a.jpg
Dailies/_Latest/1234_ProjectName_Image02_COMP_v01a.jpg
Dailies/_Latest/1234_ProjectName_Image03_COMP_v01a.jpg
If a new file is added called
Dailies/_Internal/Image01/1234_ProjectName_Image01_COMP_v02a.jpg
then this file is copied from its source folder and put into the Destination folder.
(DESTINATION)
Dailies/_Latest
Dailies/_Latest/1234_ProjectName_Image01_COMP_v01a.jpg
Dailies/_Latest/1234_ProjectName_Image01_COMP_v02a.jpg
Dailies/_Latest/1234_ProjectName_Image02_COMP_v01a.jpg
Dailies/_Latest/1234_ProjectName_Image03_COMP_v01a.jpg
Here there is already an image with the same name except the version number so the script should also delete the old file leaving me with.
(DESTINATION)
Dailies/_Latest
Dailies/_Latest/1234_ProjectName_Image01_COMP_v02a.jpg
Dailies/_Latest/1234_ProjectName_Image02_COMP_v01a.jpg
Dailies/_Latest/1234_ProjectName_Image03_COMP_v01a.jpg
I can't for the life of me figure out how to do this, any ideas would be greatly appreciated.
Screengrab of my very basic automator here

Replacing a files into multiple folders/subdirectories

Is there a way in command prompt to take files and replace it into another folder and it's sub directories based on it's name?
I have an images in my folder and i have folder have sub directories that have the same name of images, what i want to do i need to replace the image in the sub directories base on the image in my main folder.
I searched for other similar questions and I found a few topics that might interest you.
Batch file to move files based on name w/o creating new folders
Batch Create a Folder Based on Filename, and Move Multiple Related
Files to The Created Folder
If you post the code you have already tried, it may be possible to fix any issues you are having.

how to predict the name of zip folder generated by windows?

I am going to prepare a (windows) server side service which allows users to download their requested files as a Zipped folder. In Microsoft windows(7) If you select all files and folders and send them to a zip folder, a random name will be assigned to the generated zip file which is the name of one files or folders in that collection.
Is there any reason that windows doesn't set a new name say new-zip-file? and how can I predict what the name would be?
The name of the zip is in fact not random,
it relies in the file you choose to click at last.
you can select multiple files but you make right click on one only file in order to zip the group of files, and thats the file name windows chooose.

Renaming Files Sequentially as they are added to a folder using Automator or Applescript

I need to rename image files sequentially as they are added to a folder. ie. image-0001.jpg and image-0002.jpg are in a folder I add test.jpg and it is renamed image-0003.jpg. I have tried automators rename function but it will start over with image-0001.jpg each time a new file is added instead of continuing the sequence.
Any help is greatly appreciated.
You could make this easy on yourself by using a handy application built into the OS called "Folder Actions". Folder Actions contains one or more special handlers, formally known as folder action event handlers, that run when they are triggered by a change in the target folder. I know I'm confusing but I'll do my best.
What you are trying to accomplish requires an adding folder items to event handler. It requires one direct parameter, which can be anything you wish i.e. target_folder. The handler requires an additional parameter as well; after receiving, which should also be a variable name, i.e. these_items. I have composed a script for you that should do the trick. I have added comments that show you what I'm doing when I do it. Here it is:
on adding folder items to the target_folder after receiving these_items
tell application "Finder"
set all_images to every item of the target_folder as list
repeat with i from 1 to the count of these_items --iterates through all the items you dropped in the folder
set this_image to item i of these_items --the current image
set the name of this_image to "image" & (i + the count of all_images) as string --renames the image based on the number of images already in the folder
end repeat
end tell
end adding folder items to
YAY! The script is done! But are WE done? Not quite. We still need to attach the script to a folder (the script won't run if you try to execute it in script editor).
To do this, first save the script as a Script File in the Folder Action Scripts folder in the Scripts folder in either the local Library folder or the current user's Library folder. Create the folder yourself if it doesn't already exist. Next, launch the Folder Actions Setup application by double-clicking it in the AppleScript folder in the Applications folder. In the window that comes up, click the + button under the table on the left (click the "Enable Folder Actions" checkbox if it isn't already checked) to open a standard file browser sheet, navigate to your desired folder, and click "Open". The Choose a Script to Attach sheet automatically opens, listing all the scripts in all of the Folder Action Script folders. Choose the newly-created script, click "Attach", and BAM you are done!
To see the script in action, drag an image onto the folder. The image is instantly renamed, regardless of if the folder window is open. If you have any questions, or if the script doesn't work, just ask me. :)
well without digging through some code and handin you an answer I'll tell you want you want to do
is create a while loop that checks for the existence of image-000 & i where i is a variable of course and if it exists increment i then when the file doesn't exist rename your file.

Mac OS X File / Folder Management: When to Copy instead of Move

The Finder uses some kind of rules to determine if an Item can be moved or will be copied. After dragging an Item, in certain cases Finder shows a drag-copy-cursor. Are these rules in an API available? Checked with Spotlight-Metadata, NSURL and NSFileManager: no result.
Here's what i came up with:
if a Folder contains a ".localized" File: the folder is copied
if a Folder is listed anywhere in a NSSearchPathDirectory
Is my assumption right? or has it to do with NSURLIsSystemImmutableKey or NSURLIsUserImmutableKey which i thought is the "Locked" flag?
Furthermore depending on various other Metadata like write-permissions and locked-flag:
ON SOURCE:
moving a readonly file: move is possible
moving a readonly folder needs login from an admin
moving a locked file creates a copy
moving a locked folder creates a copy
moving a folder with a locked file inside: move is possible
moving a selection with both locked and unlocked items creates a copy
moving a dropbox writeonly folder: move is possible
writeonly files do not exist in Finder
moving a file without any permissions: move is possible (as the move rights depend on the enclosing folder)
moving a folder with a file without any permission: move is possible (as long its a move, for copy it asks for login)
if a Folder contains a ".localized" File: the folder is copied
if a Folder is listed anywhere in a NSSearchPathDirectory (home directory, ...) it is copied
if a folder contains another book: move is possible
ON TARGET:
moving an item into a dropbox creates a copy
moving an item into a locked folder: not possible
moving an item into a read-only folder: asks for login
*) Regarding the Finder: if a file or directory is being dragged from one volume to another, it will (by default) be copied. If the action is being performed on the same volume the file or folder will (by default) be moved. As a side note to file operations on volumes: 'moving' things across different filesystemes behaves differently, again. Normally, moving a file or directory doesn't mean 'copying' and 'deleting' the original afterwards - only their links within the filesystem usually become modified but here and then, it actually behaves exactly like that.
*) Furthermore, take care of the objects permissions: if filesystem permissions to that source file or a directory (and it's content within) doesn't allow write operations to it, it will be copied again.

Resources