When moving files to my Linux box, I usually fire up the Terminal and do something like this:
1) Find the file in finder
2) Open a terminal window
3) cd <directory where file is>
4) scp <file> me#host:/home/me/
5) ssh into the remote server
6) cd /home/me
7) mv <file> /directory/where/it/needs/to/be
Not hard, but this minute or so of tedious work is a waste of my time.
I've only written the most minimal of AppleScript. As a way to get more familiar with it, I'd figure I'd write a script to automate this process. I imagine something like this:
1) I find the file with Finder
2) Right click on the file and select "Send to server" (or maybe I use a hotkey instead). It would have the IP address of my main server as a default but it might also give me the option of sending to another IP addresses.
3) The script prompts me to type in remote directory server where it should go
4) Do more productive things with my time
I know Perl and can handle the back end code that would actually upload and move the file on the server. I just need to be able to create the interface that I interact with and then launches my Perl script.
I'm hoping someone can save me a few hours of research and trial and error by pointing me in the right direction. I'm not really sure where to begin. I'll be sure to share my script here when done.
Choose Automator for that task. Reason: all actions you need are there - connecting servers, selecting and moving files plus use it as service in right click context. I'd just handle some extra stuff like dialogs with applescript (also possible from within automator). If you want to save time that's your way to go.
If you create a new task, choose service that you can access it from contextual menus. More details see here: https://computers.tutsplus.com/tutorials/introduction-to-automator-services--cms-20782
Related
I would like to automate a quick start of SQL-MVC.
Can I set a script to run automatically after a git repo is cloned? like this:
auto-run.sh
Also, is it possible to launch a browser window to automatically open to the applications URL at the end of the script?
I have checked all the docs, but I don't find anything on the subject.
From the Git book src:
It’s important to note that client-side hooks are not copied when you clone a repository. If your intent with these scripts is to enforce a policy, you’ll probably want to do that on the server side; see the example in “An Example Git-Enforced Policy”.
So, the automatic running of a script on clone is not going to work. However, you can commit the auto-run.sh file within your repository and ask the user to run that after cloning.
You can open a new browser window on your local machine by adding the correct command within the shell script, (for example, on a mac I usually just use open). However, since Cloud9 workspace doesn't have a window manager, you won't be able to do that from the Cloud9 Terminal. One way to open a browser pane within Cloud9 IDE (not in another tab, I don't think that's possible) is to echo the url, and ask the user to click on it at the end of the script, so something like this:
Please click https://www.google.com to continue
and the Cloud9 terminal is smart enough to open the url in a new browser pane within the IDE when the user clicks on the url.
I am from a windows background and trying to help a mac user friend to backup her pictures, docs, etc. onto an external drive. In windows, I would accomplish this by creating a simple batch file with an xcopy command and have a shortcut on the desktop that pointed to that .bat file when double clicked. However, in the mac world I am having significant trouble finding how to do this. I have searched repeatedly to find the mac equivalent, but all I find are sites saying things like "there are so many options on a mac - use one of them." However, none have ever given a specific solution nor pointed to a specific solution. Anyone here know of a specific step by step process to accomplish this? I simply want to be able to have her double click an icon on the desktop and have it copy her personal documents (not application settings or other overhead) to her external hard drive. Any help would be appreciated.
Create the batch file, which is usually called a shell script.
Enter all the commands that you want to run.
Set the executable bit, this is done with chmod +x path-to-the-file in Terminal.
Show info for the script and set Terminal to the application which should open it.
However, what I've done in similar situations and that I would recommend that you do is that I've created a shell script and instead of using Terminal I've initiated it from an AppleScript application. You can of course embed the entire shell script in the AppleScript as well. Basically it will look something like the following:
on run
do shell script "rsync -av ~/Pictures /Volume/Backup"
end run
Repeat the do shell ... line for each folder that you want to copy, or call the shell script itself. Then use AppleScript Editor which is included with Mac OS X and save it as an actual application.
I would like to compare local and remote files via sftp or other method, dreamweaver has the option of doing this in your favorite merge editor (i like winmerge), but I am not using dw at this juncture. Are there any other decent (windows7) programs out there that do synchronize and compare nicely?
Beyond Compare does (using our SFTP components BTW), but the way is not quite obvious -- you need to enter the URL in the form of "sftp://username#host.tld/path/to/directory/" as a directory to compare. I have yet to find how to store this string in some reusable way in Beyond Compare.
Upd: Forgot to mention that Beyond Compare handles regular FTP and FTP-over-TLS as well.
We use Beyond Compare here too. In DreamWeaver you can identify a compare program to use during synchronization - click CTRL-U to open the Preferences dialog box; the option you want is about half way down: "File Compare". There you enter the *.exe program location for the compare application you wish to interact with DreamWeaver. If you DreamWeaver is connected to a remote server click on the root folder or a folder you wish to compare, right click and choose 'Synchronize'. Dreamweaver will use it's FTP settings to find differences in files, if you choose compare the FTP (or SFTP) facilities in DreamWeaver will download the remote file to a temporary location and will engage the Compare Software you have instructed it to in your DreamWeaver Preferences.
When debugging in Xcode, how do I simulate a user starting my Cocoa droplet application by dropping one or more files onto it's application icon?
The app just opens, processes the files while displaying it's progress and then closes again.
Passing arguments (via the "Arguments" tab of the entry under "Executables") should allow this, but I could not find out how.
What I really want is to hit "Build and Go" and then have the droplet open with whatever files I need.
A last resort would be to use AppleScript or the "open" command on the command line to achieve this. I want to streamline this as much as possible.
Thanks for any pointers!
Add each absolute path to a file you want to open with the application as an argument. You may need to wrap each one in quotation marks (which shouldn't be necessary, and is a bug if it is, but I do remember needing to do).
You should be able to use variable references like $SRCROOT in order to refer to files within the project root directory.
I want to known who is locking a file on a network share.
Here is the problem : the network share is on a NAS, so I can't log on. I need a tool to find out remotely who is locking the file. It is not practical to reboot the NAS every time, because there are several users.
Handle.exe, Process Explorer and PsFile seems to be limited to files on the local machine, so they don't work for me.
Just in case someone looking for a solution to this for a Windows based system or NAS:
There is a built-in function in Windows that shows you what files on the local computer are open/locked by remote computer (which has the file open through a file share):
Select "Manage Computer" (Open "Computer Management")
click "Shared Folders"
choose "Open Files"
There you can even close the file forcefully.
On Windows 2008 R2 servers you have two means of viewing what files are open and closing those connections.
Via Share and Storage Management
Server Manager > Roles > File Services > Share and Storage Management > right-click on SaSM > Manage Open File
Via OpenFiles
CMD > Openfiles.exe /query /s SERVERNAME
See http://technet.microsoft.com/en-us/library/bb490961.aspx.
PsFile does work on remote machines. If my login account already has access to the remote share, I can just enter:
psfile \\remote-share
(replace "remote-share" with the name of your file server) and it will list every opened document on that share, along with who has it open, and the file ID if I want to force the file closed. For me, this is a really long list, but it can be narrowed down by entering part of a path:
psfile \\remote-share I:\\Human_Resources
This is kind of tricky, since in my case this remote share is mounted as Z: on my local machine, but psfile identifies paths as they are defined on the remote file server, which in my case is I: (yours will be different). I just had to comb through the results of my first psfile run to see some of the paths it returned and then run it again with a partial path to narrow down the results.
Optionally, PsFile will let you specify credentials for the remote share if you need to supply them for access.
Lastly, a little known tip: if someone clicks on a file in Windows Explorer and cuts or copies the file with the intent to paste it somewhere else, that act also places a lock on the file.
If its simply a case of knowing/seeing who is in a file at any particular time (and if you're using windows) just select the file 'view' as 'details', i.e. rather than Thumbnails, tiles or icons etc. Once in 'details' view, by default you will be shown;
- File name
- Size
- Type, and
- Date modified
All you you need to do now is right click anywhere along said toolbar (file name, size, type etc...) and you will be given a list of other options that the toolbar can display.
Select 'Owner' and a new column will show the username of the person using the file or who originally created it if nobody else is using it.
This can be particularly useful when using a shared MS Access database.
The sessions are handled by the NAS device. What you are asking is dependant on the NAS device and nothing to do with windows. You would have to have a look into your NAS firmware to see to what it support. The only other way is sniff the packets and work it out yourself.
Partial answer: With Process Explorer, you can view handles on a network share opened from your machine.
Use the Menu "Find Handle" and then you can type a path like this
\Device\LanmanRedirector\server\share\
sounds like you have the same problem i tried to solve here. in my case, it's a Linux fileserver (running samba, of course), so i can log in and see what process is locking the file; unfortunately, i haven't found how to close it without killing the responsible session. AFAICT, the windows client 'thinks' it's closed; but didn't bother telling the fileserver.
Close the file e:\gestion\yourfile.dat, open by any user (/a *)
openfiles /disconnect /a * /op "e:\gestion\yourfile.dat"
more in:
http://dosprompt.info/commands/openfiles.asp