Find the answer to your Linux question:
Results 1 to 10 of 10
Hello im new to linux i installed OpenSuse 11/KDE ok i downloaded an Mp3 file its on the desktop i made new folder #mk dir mp3 i know this but ...
  1. #1
    Just Joined!
    Join Date
    Aug 2008
    Posts
    6

    Move Files ? Copy and Paste ?

    Hello

    im new to linux

    i installed OpenSuse 11/KDE

    ok i downloaded an Mp3 file its on the desktop
    i made new folder #mk dir mp3 i know this

    but i try to move the file to the new directory
    #mv file.mp3 dir

    but its not working

    and also there's something confusing linux doesn't recognise files with space

    i mean file look like this
    song 1.mp3

    if u do any action with this file it will not recognise it, it will think that the file is called song NOT song 1.mp3

    is that right ?

  2. #2
    Just Joined!
    Join Date
    Jul 2008
    Posts
    27
    what a permission of directory and file.mp3?

    turns out any error?

  3. #3
    Just Joined!
    Join Date
    Dec 2007
    Posts
    86
    To move a file or package to a directory/folder, you can do this:

    Right-click on mouse, then "Move To".

    You could have a default download folder, like: /home/Amman_DJ/My_downloads_MP3.

    To get the file automatically downloaded there, you could configure your browser.

    Firefox; Edit; Preferences; Main; Downloads; Save File to /home/Amman_DJ/My_downloads_MP3

    I hope this helps.

  4. #4
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    1,939
    Code:
    linux doesn't recognise files with space
    That's right! But it does recognize underscore (_), dash (-), etc.
    Code:
    i made new folder #mk dir mp3 i know this
    I assume the line above is a typo? Needs to be 'mkdir' as below:
    In the terminal type: mkdir dir_mp3
    This will give you a directory called 'dir_mp3' in your root directory. If you then have a downloaded file called 'file.mp3' you can move it to this directory by changing to your Desktop directory in /home/username/Desktop/

    mv file.mp3 /dir_mp3

    If you have files in windows with spaces you can act on them (cp, mv, etc.) by putting quotes (") around the file name.

  5. #5
    Just Joined!
    Join Date
    Aug 2008
    Posts
    6
    Thanks Guys

    it works with me perfect like this

    #mv *.mp3 /DIR

    and it moved all files that ends with .mp3

    A m a z i n g !

  6. #6
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,695
    Quote Originally Posted by yancek View Post
    Code:
    linux doesn't recognise files with space
    That's right! But it does recognize underscore (_), dash (-), etc.
    [CODE]
    Huh? That is a completely wrong statement. The command being used is *wrong* - it has nothing to do with "Linux doesn't recognize the file."

    Code:
    cp Song 1.mp3 /folder
    The command above says to copy the TWO files "Song" and "1.mp3" to /folder. Since there is no file named "Song" or "1.mp3" you get an error.

    Correct:

    Code:
    cp "Song 1.mp3" /folder
    cp Song\ 1.mp3 /folder
    So imagine if someone finds your post and then continues to spread the "information" that Linux "can't recognize files with spaces in the name."

  7. #7
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by Amman-DJ View Post
    but i try to move the file to the new directory
    #mv file.mp3 dir

    but its not working
    Post the error, or describe *what* isn't working, or *why* do you think it isn't working.

    and also there's something confusing linux doesn't recognise files with space

    i mean file look like this
    song 1.mp3

    if u do any action with this file it will not recognise it, it will think that the file is called song NOT song 1.mp3

    is that right ?
    It does. However, just like in windows command line, the space is used by the shell as a separator. Each space separates one positional argument from the next one. If you do this:

    Code:
    mv file1 file2 dir/
    You are telling your shell to move two files into a folder, and that's what you are doing. The fact that the files are called "song" and "1.mp3" doesn't change that fact.

    So, either quote the file names (like you'd do on windows) or "scape" the space, so it doesn't get interpreted like a separator by the shell:

    Code:
    mv "file 1.mp3" dir/
    #or
    mv file\ 1.mp3 dir/
    Linux has complete support for spaces, and for all the funny chars you could ever need. Just make sure you scape or quote all the special chars when needed.

    Cheers.

  8. #8
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    1,939
    Just re-read my previous post and see the error. Obviously, files with spaces are recognized. The point I was trying to make was the need for "" or \ in the name for the command to work. Poorly written post, my mistake.

  9. #9
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    I see. Yep, that's the thing

    Anyway, being slightly more correct, this is related to the shell really, and not linux intrinsically. It's the shell who parses the commands, if you use the same shell under windows on cygwin, in bsd, solaris, hp-ux or any other compatible OS, you will get the same behavior. The only efficient way to change this would be to substitute the separator with another character (e.g. '+' instead of ' ', or any other), but then, if you wanted to include that another separator in a file name, you would need a way to scape it as well. So, it doesn't really make any sense to do it on a different way than it is right now because spaces are more natural and more legible for humans.

    People that are not comfortable with scaping characters, can just use quotes, which meaning is evident enough, or just use names without spaces.

  10. #10
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    1,939
    Code:
    Anyway, being slightly more correct, this is related to the shell really, and not linux intrinsically
    Understood. The point I was trying to get across in the context of what the OP was trying to do was that it would be simpler to use a dash (-), underscore (_) etc. if he wants a multiple word file/directory. I find this easier but that's a personal choice. This gives a clearer title in some instances and still has the look of a space making it easier to read. Since he already had the file it seemed the simplest way would be quotes.

Posting Permissions

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