0
find /media/shamsad/1E8A00A88A007E91/ -name '*.json' \
    -exec  mongoimport --db twitter --collection twitterCol --file {} \;

The above script was working perfectly but the below one is generating an error:

find /Desktop/L3T1/DatabaseSessional/TestMongotweet/ -name '*.json' \
    -exec  mongoimport --db twittersmall --collection twitterdata --drop --file {} \;

Error:

find: ‘/Desktop/L3T1/DatabaseSessional/TestMongotweet/’: No such file or directory

Is there a whitespace problem?

wjandrea
  • 14,236
  • 4
  • 48
  • 98
sphoenix
  • 961

1 Answers1

3

Your Desktop directory is stored in your home directory, and your home directory is normally a subdirectory of /home with the same name as your login. So if your user name was "bob" your desktop directory will probably be /home/bob/Desktop (note that when the account is created, /home/user_name is just the default -- it could be set to something else). You can use ~ as a shortcut for typing the path to your home directory.

Therefore if you want to search you Desktop directory, you should refer to it as ~/Desktop and your command would become

find ~/Desktop/L3T1/DatabaseSessional/TestMongotweet/ -name '*.json' \
-exec  mongoimport --db twittersmall --collection twitterdata --drop --file {} \;

/media, the place the system typically mounts CDROMs, USB sticks etc., is in the root directory and therefore your first command worked fine.

Nick Sillito
  • 1,596