How can I see invisible files?

One of my pdf utilities won't work until I remove the .DS_store file from the relevant folder.


How can I see invisible files and, if necessary, remove them? It's not under Finder > View or Finder > View > Show View Options. It's not listed in Help search. Ive tried using Tinkertool and relaunching the finder, but to no avail.

MacBook Air (11-inch Mid 2013), macOS Sierra (10.12.6)

Posted on Feb 5, 2018 4:07 PM

Reply
Question marked as Top-ranking reply

Posted on Feb 5, 2018 5:52 PM

See if these Terminal commands work.


Hidden files - show: defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder


Hidden files - hide: defaults write com.apple.finder AppleShowAllFiles FALSE -boolean false ; killall Finder

21 replies

Feb 9, 2018 9:39 PM in response to Marja E

This one is a bit more complicated.

It will take the selected files or folders and combine the pdfs into a single file.

For files, it will save the combined pdf in the same folder as the first file selected, and use the name you choose.

For folders, it will save the combined file inside the folder using the folder name as the file name.

If you select both files and folders, it will combine the individual files into one file, and the files in the folder into another file.


  • Open Automator and create a New Service -- cmd-N, then select Service as the type.

    You should see a Library pane on the left and a blank workflow pane on the right.

  • At the top of the workflow pane, set it to:

    Service receives selected files or folders in Finder

  • From the Library pane, select Utilities
  • From the Actions list, drag in a Set value of variable Action

    Set the name of the variable to "AllItems"

  • From the Files & Folders Library, drag in a Filter Finder Items Action

    Set it to:

    • All of the following are true
      • Kind is folder
  • From the Actions list, drag the Run Shell Script Action into the workflow pane
    • Leave the Shell: /bin/bash
    • Set Pass input: as arguments
  • Replace the code for the shell script with:
for f in "$@"
do
  find "$f" -name ".DS_Store" -exec rm -f {} \;
  dot_clean -m "$f"
  fileName="$f"/$(basename "$f").pdf
  /usr/local/bin/cpdf -merge -idir "$f" -o "$fileName"
done
    • On the last line, you need to use the full path to your cpdf program. I put mine in /usr/local/bin. If you put it in Applications, then the line would start with:

      /Applications/cpdf/usr/local/bin/cpdf

    • Inside do, the first line finds the .DS_Store file and deletes it
    • The second line removes any metadata files that come from another filesystem ( ._filename ). These likely won't be there unless you are running this on a files on an MS_DOS USB Stick or similar.
    • We could add other find/delete commands in there if you start getting other non-pdf files
    • It then creates the file name and uses cpdf to merge the PDFs.
  • From Utilities, drag in a Get Value of Variable
    • Select AllItems from the List
    • Right-click on the Action, near the top, middle and select Ignore Input

User uploaded file

  • Drag in another Filter Finder Items Action from Files & Folders

    Set it to: All > Kind is PDF

  • Drag in a Run AppleScript Action from the Utilities Library

    Set the code to:

on run {input, parameters}
  if input is not {} then
       set MyFileName to text returned of (display dialog "Enter a file name for merged PDFs:" default answer "Combined PDFs" buttons {"Cancel", "Merge"} default button "Merge")
       set pathList to {}
       repeat with anItem in items of input
            set pathList to pathList & POSIX path of anItem   
       end repeat
       return (MyFileName as list) & pathList
  end if
end run

Drag in another Run Shell Script Action

  • Leave the Shell: /bin/bash
  • Set Pass input: as arguments
  • Set the code to:
fileName="$1"
if [ $# -lt 2 ]; then
  exit 0
else
  filePath=$(dirname "$2")/"$fileName".pdf
  /usr/local/bin/cpdf -merge "${@:2}" -o "$filePath"
fi


Save this Service as something like Merge PDFs.

Select Files, Folders, or Files and Folders

Right-click on the selection and choose Merge PDFs from the Services submenu.


It will overwrite the file without warning if you run it again on a folder. So, if you want to preserve a generated file, rename or move it before running the Service on that folder again.


I didn't combine the other two processes, but I think I could do it by asking you if you want to OCR, or OCR and K2.

If you just run it through k2pdfopt, does it have the same options as when you OCR first?


Also, are the files always PDFs? Or can they be image, text, or other types. I didn't dig deep into the manual for cpdf, but it seemed like it only handled PDFs.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How can I see invisible files?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.