View Full Version : [SOLVED] Copy Files with the Command Line - Error Using Parentheses
October 8th, 2012, 03:32 AM
How do you copy files with () in the name using the command line?
eg. = cp my (file) name.txt /home/user/Documents
result = -sh: syntax error: "(" unexpected
I know you have to put "\" before a space in the file name, but what do you do about parentheses in the file name?
October 8th, 2012, 03:39 AM
you can try using \ to escape () too, but it would be easier to put the name in quotes "" or '' (now you wont have to manage spaces either)
besides try autocompletion - type first few chars, press tab and the name should be expanded to its full form, with all the necessary escaping done for you, as long as there is no ambiguosity.
October 8th, 2012, 03:40 AM
what do you do about parentheses in the file name?
You can do the same, and escape them:
mv myfile\(2012\).txt /tmp
or you can use quotes:
mv "myfile(2012).txt" /tmp
Let us know how it goes.
October 8th, 2012, 03:49 AM
That got it. Thanks!
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.