How to zip archive individual sub folders - archive

I have a main folder called "Test" under that I have around 100 sub folders starting from test 1, test 2 ..... test 100.
I am trying to create a work flow in Macautomator. But it puts all the 100 folders into one big archive file rather than creating 100 archive files with its original name in the mail Test folder.
am I expecting too much from the automator. I would greatly appreciate your help .
thanks in advance.

I can help you out. Create the following Automator Workflow:
Ask for Finder Items
select folders
Set Value of Variable
variable name I put was "folder"
Get Folder Contents
select "Repeat for each subfolder"
Dispense Items Incrementally
Create Clean Archive
select "Deleting original files"
Loop
select "Loop Automatically" and "stop after 100 times" (or how many you want)
This should work. I tested it out.

Related

Batch Name Change Based on Current File Name

I have a bunch of files named with the following structure.
BIOSTD_2022-05-11_08-07-29_LastName_FirstInitial_70061643.pdf
The First set of numbers if obviously the date and the second set is the time the file was created. I'd like to batch change the names to the following file structure
LastName_FirstInitial.pdf
and then move it to a new folder with the date in the original file name. There will be multiple files with the same date.
Can anyone help me out?
Thanks
Greg
I really don't know where to start.

How to randomize file order on folders with a batch file

am trying to get a batch file to help me randomize files.
Files are videos/music/text/doc
To be more specific, lets say am having the following files on a folder named like this:
3020_1
3020_2
3020_3
3020_4
3020_5
6031_1
6032_2
5013_1
6060_1
Windows will sort them as above, and i would like to get a folder with the above files to appear randomly.
Can you guys help me out :)
I am sure you are aware of the fact that the order of appearance of files in a Windows folder depends on the sort option you have chosen. Assuming you still want to do this in a given sorted view and you are OK renaming files, you can try the ren command to do this. Find more details here
ren 3020_1 3020_2
Since you want this to be random, you will have to add a bit of logic to get a random file name.
%RANDOM% will give you a random number every time you execute it. More information on that is available here
Hope this gets you move further

Applescript how to make file list and move files with certain names

I want to make a script that takes a list of names, and moves certain files that have the similar names to the list, into another folder.
To break it down, I have a folder with a few files "appleClient2016.pdf", "fruitClient2016.pdf", "pearClient2016.pdf"
Now I have a list of "appleSept", "pearSept"
I want to move my list into another folder.
I need a script that recognizes appleSept and appleClient2016.rtf both have apple in the string and will move the pdf into another folder. Also it can only move pdf files.
I am very new to applescript but here is my attempt
set listOfFruits to {"appleSept", "pearSept"}
tell application "Finder"
if folder "moveTest1" contains listOfFruits then
move (every file of folder "moveTest1" whose name is listOfFruits) to folder "moveTest2"
end if
end tell
I know I have a few syntax errors here, but I think you get the idea of what im going for.
Any advice would be greatly appreciated.
Thanks!
Think about two things regarding listOfFruits which is a list of strings.
A folder never contains a list of strings it contains a list of files or folders (contains listOfFruits).
A file has never a name which is a list of strings (whose name is listOfFruits).
Basically it is not needed to check 1. with an if clause.
To check if a name is in a list of strings you have to write is in rather than is.
To understand the syntax is in: The expression a is in {a, b, c} is the same as {a, b, c} contains a
set listOfFruits to {"appleSept", "pearSept"}
tell application "Finder"
move (every file of folder "moveTest1" whose name is in listOfFruits) to folder "moveTest2"
end tell

Automator or Applescript, detect a new file in folder

I am trying to write something that will detect a new file in a certain specified directory. I preferably would like this script to continue running indefinitely, and whenever I see a new file, I can copy it and move it somewhere else. I know this has to be possible, because dropbox does it, but I just do not know how to get this working or where to start. Any ideas?
Here is another example of a folder action. You should save the script in ~/Library/Scripts/Folder Action Scripts .
on adding folder items to theFolder after receiving theFiles
-- This should make the folder action wait until large files have finished copying to the folder
set fSizes to {0}
repeat
tell application "System Events" to set end of fSizes to size of theFolder
if (item -1 of fSizes) = (item -2 of fSizes) then exit repeat
delay 1
end repeat
-- If you want to do something with each file ...
repeat with aFile in theFiles
-- your code goes here
end repeat
end adding folder items to
Keep in mind that if your script saves anything to the target folder, the folder action will be triggered again.
What you're looking for (to spawn off Applescripts when adding new files into a "hot folder") is called "Folder Actions", and there are a number of tutorials that can be found online that should point you in the right direction.
For example, here is one: "AppleScript: Exploring the power of Folder Actions, part I"

Looping through all the inputs and creating distinct output files

I am using cygwin on Windows 7. I have a folder with about 1200 files of the same type(There are no sub-directories). I am trying to go through the folder and perform a certain action(it's bioinformatic alignment) on each file. Here is the code that I am using:
$ for file in Project/genomes_0208/*;
do ./bowtie-build $file ../bowtie-0.12.7/indexes/abc;
done
./bowtie - build is the operation that I want to perform. Now, this does complete the operation for all the files in the folder,but it keeps writing the ouput in the same file abc in this case.
So in the end I have only 1 file with the latest output. How can I create 1200 different files , one for each of the input? It doesn't matter what I name the output files, it could be anything, as long as they are obviously different.
Hope I explained the problem successfully, I'd appreciate any help with this!
How about:
./bowtie-build $file "${file}.out"
If your files had unique names to begin with this should also produce unique output files.

Resources