-1

I am running out of space in my local device. I have external hard disk. I want to point my python code to write to directory there. How can I know the full path for the hard disk?

I tried to go to media directory. I used ls and found only one directory with the same user name x. I cd to x, and found the hard disk name. When I try to cd to the hard disk name I get this message: too many arguments

x@x-device:/media$ ls
x
x@x-device:/media$ cd x
x@x-device:/media/x$ ls
'Seagate Backup Plus Drive'
x@x-device:/media/x$ cd Segate Backup Plus Drive
bash: cd: too many arguments

Q: How to find the full path of a directory in an external hard disk? How can I open a file in my external hard disk in python program?

v = open("my_file_in_the_external_hard_disk.txt","r")

EDIT: File system is: NTFS/exFAT/HPFS

Edit: I changed the hard disk name to remove spaces. I will post this as an answer.

1 Answers1

1

x@x-device:/media/x$ cd Segate Backup Plus Drive bash: cd: too many arguments

Your command did not work because you didn't quote the spaces. It has nothing to do with where the directory is physically located. A proper way to cd into a directory with spaces (or call any other command on it) would be

$ cd 'Segate Backup Plus Drive'

or

$ cd "Segate Backup Plus Drive"

or

$ cd Segate\ Backup\ Plus\ Drive

You can save a lot of typing by using the Tab autocomplete feature in Bash:

$ cd S Tab

will expand into

$ cd Segate\ Backup\ Plus\ Drive
undercat
  • 1,857