The shell really doesn't like spaces. There are 2 things you can do, either replace the spaces with a character - like an underscore - or whenever you manipulate a file that has spaces, put it in double quotes. Your initial cp command would work if you did it this way:
cp "MY DATA.TXT" "MY DATA.BAK" Honestly, the best thing to do would be to replace the spaces with underscores - like this: mv "MY DATA.TXT" MY_DATA.TXT and then manipulating the files with the cp command or whatever will work like you want it to. HTH, Scott On Sat, Feb 20, 2010 at 1:16 AM, Dos-Man 64 <[email protected]> wrote: > I've had some trouble trying to perform general shell commands like cp > and mv on file names that contain spaces. > > Let's say for example I have a file named MY DATA.TXT. > > Now let's say I want to create a backup copy of it. > > cp MY DATA.TXT MY DATA.BAK > > Well, I don't think that worked, presumably because the shell thought > MY and DATA.TXT represented two different files. I could type in the > whole path of MY DATA.TXT and enclose it double quotes or something? > > cp "/home/MY DATA.TXT" "MY DATA.BAK" > > Does traditional Unix allow spaces in file names? What is the best > way to deal with these kinds of file names? > > -- > You received this message because you are subscribed to the Linux Users > Group. > To post a message, send email to [email protected] > To unsubscribe, send email to [email protected] > For more options, visit our group at > http://groups.google.com/group/linuxusersgroup -- <>< Scott Vargovich <>< ------------------------------------------ OpenPGP Key ID: F8F5DC7E ------------------------------------------ -- You received this message because you are subscribed to the Linux Users Group. To post a message, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit our group at http://groups.google.com/group/linuxusersgroup
