Find the answer to your Linux question:
Results 1 to 5 of 5
hi hope you are well...the thing is i want to know if i have a folder named whose absolute path is as follows /home/someuser/this folder name has spaces/ how would ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2007
    Posts
    15

    using "find" to locate files in a folder when folder name has spaces


    hi
    hope you are well...the thing is i want to know if i have a folder named whose absolute path is as follows
    /home/someuser/this folder name has spaces/

    how would i use find to look for a file abc.txt in this folder meaning
    if i use

    find /home/someuser/this folder name has spaces/ -wholename="*abc.txt"


    i get errors like

    find: /home/someuser/this: no such file or directory
    find: folder :no such file or directory
    ..
    ..
    ...
    ..
    i know the error becuase of the fact that the name has spaces can anyone please suggest how to overcome this i have tried doing



    find "/home/someuser/this folder name has spaces/" -wholename="*abc.txt"

    no results
    find '/home/someuser/this folder name has spaces/' -wholename="*abc.txt"
    no results





    can anyone please suggest how to over come this

  2. #2
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,393
    You can do
    Code:
    find /path\ to\ some\ dir/ -name "*abc.txt"

  3. #3
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,134
    Have you tried /home/someuser/"this folder name has spaces"/?

    Or rename the folder. Spaces are evil.

  4. #4
    Just Joined!
    Join Date
    Aug 2007
    Posts
    15

    Thumbs up

    thank you so much daark.child and rcgreen. i tried your code daark.child and its working perfectly...
    thank you so much to both of u for finding time to reply
    thanks

  5. #5
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    Quote Originally Posted by rcgreen View Post
    Spaces are evil.
    Spaces aren't evil, they're separators! Don't fight the system's philosophy.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •