I'm trying to import a JPG to my uploads folder using WP-CLI (macOS). I'm connected to the server, I can update and activate plugins, successfully navigate to all folders, etc.

However, when I run:

wp media import /Users/d.j./Desktop/cat.jpg

I get an error:

Warning: Unable to import file '/Users/d.j./Desktop/cat.jpg'. Reason: File doesn't exist.
Error: No items imported.

The file does exist, it's right on my desktop.

Any ideas as to why I would get this error?

edit: I should add that it works fine when I use my local server.

  • Possibly you need ~ at the start of your path to find the right directory.
    – vancoder
    Commented Jul 12, 2021 at 19:00
  • I also tried ~/Desktop/cat.jpg, and I also dragged the file into the terminal window to make sure the path was correct.
    – itsjustdj
    Commented Jul 13, 2021 at 20:08

1 Answer 1


I figured it out, with some help. You have to be on the same server where the files are located to use wp media import. The steps are:

  1. Log out of ssh connection
  2. Log into the remote server using sftp
  3. Upload the files using sftp, then log out
  4. Log back in using ssh
  5. Then you can use wp media import

Essentially, ssh is for commands and sftp is for file transfers.

I hope this helps someone else with this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.