Within the finder I can view the contents of User/Library and can see many folders there, however I cannot see a folder called LaunchDaemons.
However if I navigate to the Library folder from the terminal command line then LaunchDaemons is visible.
How can I make it appear in the Finder?
I've tried this command but it didn't have any effect
defaults write com.apple.Finder AppleShowAllFiles YES
There is (at least by default) no LaunchDaemons folder in the user Library. You may be navigating to one of the other Library folders in Terminal. You can check this with the commands pwd (which prints the full path to the current folder -- if it doesn't start with /Users/youraccountname/Library, you aren't in your user Library) and open . (which opens the current folder in the Finder -- and again, I'm pretty sure it won't be inside your user Library).
Related
I'm an applescript noob. So I don't know anything about this type of coding.
I want to make a script for a watch folder. I work with an image program that processes images. The process takes a second to create the jpg. So the folder has to wait for a few seconds to move the image to another file.
So this is what I'm looking for: Empty folder - jpg in the folder - wait 2 sec - move jpg to another folder - empty folder.
Thank you!
This AppleScript will accomplish what you asked. By the very nature of AppleScript, reading it should be very self explanatory as to what each line does:
on adding folder items to ThisFolder after receiving SomeFiles
set ThatFolder to POSIX file "/path/to/new/folder"
delay 2
repeat with TheFile in SomeFiles
tell application "Finder" to ¬
if name extension of (TheFile as alias) is in {"JPG", "JPEG"} then ¬
move TheFile to ThatFolder
end repeat
end adding folder items to
This is designed to run as a folder action, which makes the folder you choose automatically monitored by MacOS so that, whenever it detects a change to that folder, it executes the script attached to it. In this instance—as you can infer from the first line of the script—this will automatically run each time a file is added to the folder in question.
To set up a folder action:
Copy the AppleScript above into Script Editor. Edit the second line to replace "/path/to/new/folder" with the path to the new folder into which you want your jpegs to be moved (keep the quotes). I wouldn't bother trying to run the script from inside the editor—it won't work. The path you type out must be in full, i.e. "/Users/Richard/Pictures/Processed" and not "~/Pictures/Processed".
Save it as whatever you like. However, it must be saved in the following directory: ~/Library/Scripts/Folder Action Scripts where ~ indicates your Home folder (i.e. /Users/Richard/ or whatever it is). If the folder "Folder Action Scripts" doesn't exist, create it.
Close Script Editor. Navigate to the folder that is going to be watched, i.e. the folder that your images will be waiting initially. Now navigate one level up, into the directory containing said folder.
Right-click on the folder and hover over the Services menu item at the bottom. Then select Folder Actions Setup...
Enable folder actions by checking the box at the top. If you folder doesn't already appear in the left-hand list, you can add it. Then, in the right-hand list, click the '+' at the bottom and the script you just saved should be one of many in the list of scripts that pop up. Select it and add it.
Make sure the check boxes next to your watched folder and your chosen script are both checked, and you're done.
Now, whenever the folder receives any files whatsoever, that script is executed. The script will move any files with extensions .jpg or .jpeg into your new folder. Just make sure the new folder already exists (I didn't incorporate a line to create it if it doesn't; the script will just throw an error and your image won't be moved).
Here is a little sample script which you could save on your Desktop as monitor:
#!/bin/bash
# Source directory to watch and destination directory to copy to
SRC="$HOME/Desktop/source"
DST="$HOME/Desktop/dest"
# Create directories if not existent
mkdir -p "$SRC" "$DST"
while : ; do
find "$SRC" -type f -iname "*.jpg" -Btime +2s -exec mv {} "$DST" \;
sleep 5
done
It basically watches a directory called Desktop/source and looks for any files in there whose name ends in "JPG" and which have not been modified in the last 2 seconds. If it finds any, it then moves them to directory called Desktop/dest and sleeps for 5 seconds before checking again.
You would need to start Terminal and make the script executable by typing:
chmod +x $HOME/Desktop/monitor
Then, whenever you want it running, you just double-click on the icon of monitor on your Desktop.
I've got my Automator project, and what I want to do is cd (change directory) into "itself" (as if you'd click Show Package Contents). How may I do that?
From there, I can create folders, create files, etc., I've got that part, however I don't know how to change directory into the Contents of my .app.
The version control system that I have to use (Perforce) by default gives me read-only files. I want to move some changes from one directory to another, and the target files are read-only. I want to clear the read-only flag from the Meld UI. (Otherwise I will have to manually locate changed files in the directory tree, which is just stupid.)
How do I clear the read-only flag on file from the meld UI?
(Something ready-to-use? Or maybe it is easy to write some small extension?)
C:\Windows\clearro.cmd:
attrib -r %1
(Menu)--Meld-Preferences--the [Editor] tab
Uncheck "Use default system editor"
specify clearro.cmd as Editor command.
Now, to clear the read-only attribute, you right-click the mouse on the file and choose "Open Externally" from the menu. Instead of opening the external editor, it will invoke clearro.cmd on the file. If you need to open the file, you can go to preferences and check the checkbox.
Yes, it should be an external tool invocation rather than an editor hack, but this at least works.
(Did not try this on Linux, but it should be something like chmod a+w $1 in the file clearro.sh, don't forget to chmod a+x clearro.sh to make it executable.)
I've been trying for literally hours to set a global alias that I can use when I open Git bash on my Windows machine to cd to a specific location.
I want to be able to simply type the alias to get to the location. I've tried every which way. The attempt that got me closest was based on this: https://superuser.com/questions/602872/how-do-i-modify-my-git-bash-profile-in-windows
...but it seems that to get it to work upon relaunching of bash, I have to use source .bashrc, which I don't want to do. Help appreciated.
I just jury rigged a solution with a simple shell script that acts like a global alias. If someone has a better solution, please do tell.
Opened text editor and wrote the following two lines:
#!/bin/bash
cd blah/blep/directory_of_choice
Saved it as a text file with a descriptive name (like dirjump) somewhere and copied it.
In file explorer, navigated to the bin folder in the MinGW64 installation, e.g. "C:\Program Files\Git\mingw64\bin"
Pasted the file into this bin folder.
While viewing the contents of the bin folder referenced above in Windows file explorer, from the menu bar selected "view > options", which opened the "folder options" dialog. Selected the "view" tab here and unchecked "Hide extensions for known file types" and clicked ok.
Deleted the ".txt" extension from the file copied into the bin folder.
To call this shell script that has the same result as a global alias, typed the following in Git bash:
. dirjump (the space between the dot and the dirjump MUST be included)
I've created a symbolic link to my WordPress theme root from my system root - so in / I have
mytheme -> /Applications/MAMP/htdocs-wordpress/wp-content/themes/mytheme
I use this all the time to quickly get to my theme root in Terminal. But I very often also want to navigate from there up to a higher directory in the WordPress hierarchy, like wp-content. When I run cd .. Terminal takes me back up to /. Is there any easy way to jump up the file hierarchy instead of to the "parent" of the symbolic link? Or any way to get an alias of my theme root that will allow this?
I would go with an alias, it makes things easier. Put this into your $HOME/.bashrc or $HOME/.bash_profile file:
alias mytheme="cd /Applications/MAMP/htdocs-wordpress/wp-content/themes/mytheme"
After that, either source it in your current terminal source $HOME/.bashrc or open a new Terminal window. This is available for any Terminal window you open and you can navigate easily from there. Another advantage is, that you don't have this symlink in your / directory.
Jumping into the directory of your theme is done by calling the name of the alias:
user#machine> mytheme
And if you want to navigate one directory back, just do it the usual way:
user#machine> cd ..
user#machine> pwd
/Applications/MAMP/htdocs-wordpress/wp-content/themes