This is the command-line equivalent of dragging a folder/pathname onto the Terminal application icon. You can also do this from the command line or a shell script: open -a Terminal /path/to/folder (Dragging into the terminal view within the tab merely inserts the pathname on its own, as in older versions of Terminal.) In addition, Lion Terminal will open a new terminal window if you drag a folder (or pathname) onto the Terminal application icon, and you can also drag to the tab bar of an existing window to create a new tab.įinally, if you drag a folder or pathname onto a tab (in the tab bar) and the foreground process is the shell, it will automatically execute a "cd" command. Go back to the parent folder, select the relevant folder, then activate the service via the Services menu or context menu. You cannot simply have the folder open and run the service "in place". The New Terminal at Folder service will become active when you select a folder in Finder. Services appear in the Services submenu of each application menu, and within the contextual menu (Control-Click or Right-Click on a folder or pathname). You can even assign command keys to them. These Services work in all applications, not just Finder, and they operate on folders as well as absolute pathnames selected in text. There's also New Terminal Tab at Folder, which will create a tab in the frontmost Terminal window (if any, else it will create a new window). System Preferences > Keyboard > Shortcuts > ServicesĮnable New Terminal at Folder. As with most Services, these are disabled by default, so you'll need to enable this to make it appear in the Services menu. ls -l > filelist.As of Mac OS X Lion 10.7, Terminal includes exactly this functionality as a Service. Double clicking on this opens it in TextEdit to reveal that the file contains an editable list of files in that folder.īy default the list consists of just the file name, however the format of this list can be changed by altering the text typed at the $ prompt. You will notice in Finder that the folder in question now includes an additional file called filelist or filelist.txt. Once the $ prompt reappears you can close the Terminal window. Type the following text and hit enter: ls > filelist.txt The Terminal windowĪ blank window will appear with a cursor next to a $ prompt (text before the prompt may vary depending upon your username and/or setup). Once enabled (or ) in Finder on the folder for which you want to produce a file list and select New Terminal at Folder from the menu that appears. To enable this facility, from the System Preferences… option choose: Once enabled, enabled (or ) in Finder on the folder for which you want to produce a file list and select Services… then Open Terminal Here from the menu that appears. Keyboard > Keyboard Shortcuts > Services.Once copied, from the System Preferences… option choose: To enable this facility you need to download the OpenTerminalHere service from Īfter unzipping, copy the Open Terminal Here.workflow file into the Library/Services folder within your user home folder (if the Services folder does not exist at this location, you will have to create it). However it is relatively straightforward to generate a such a list.īefore use the facility has to be enabled. One downside of the GUIs (Graphical User Interfaces) used on most computers is that it can be difficult to directly copy lists of files within folders. 2554How can I produce a list of files within a folder in Mac OS X?
0 Comments
Leave a Reply. |