Inside of my Linux directory, I have a file named TopSample$Config.class
.
Whenever I try to copy this file to another location/directory, it is not allowing me to do so.
I am doing it this way:
cp TopSample$Config.class /home/praveen/com/config/
Please let me know if this isn't possible.
Windows has a limitation where the entire path to a file cannot be over 255 characters. Microsoft has a command line copy program called "Robocopy" (Robust Copy) that can copy files without this limitation. ROBOCOPY will accept UNC pathnames including UNC pathnames over 256 characters long.
You can copy files by right-clicking on the file and selecting "Copy", then going to a different directory and selecting "Paste". For my terminal friends, you can also perform file copy-paste operations without leaving the terminal. In a Linux-based terminal, you do this using the cp command.
By Using cp Command Linux system users can copy folders, directories, and files using the cp command. We can use cp commands along with destination and source only. Here along with the file's path, the filename is also changed—the syntax for the cp command.
Unix does not have a command specifically for renaming files. Instead, the mv command is used both to change the name of a file and to move a file into a different directory.
The shell will interpret $Config
as a variable. And it will expand to empty string.
You can put single quotes around to keep the literal value:
cp 'TopSample$Config.class' /home/praveen/com/config/
Another way is to escape the $
(dollar sign) by using \
(backslash)
cp TopSample\$Config.class /home/praveen/com/config/
Put single quotes around the filename.
cp 'TopSample$Config.class' /home/praveen/com/config
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With